home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / jikes-1.02 / src / javaact.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-26  |  106.7 KB  |  4,564 lines

  1. // $Id: javaact.cpp,v 1.11 1999/08/26 15:26:14 shields Exp $ //
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler Open
  4. // Source License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1999, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #include "config.h"
  12. #include "parser.h"
  13. #include "ast.h"
  14.  
  15. #undef HEADERS
  16. #include "javaact.h"
  17.  
  18. //****************************************************************************//
  19. //****************************************************************************//
  20. //*                                                                          *//
  21. //* Below, we show each rule of the Java grammar together with the semantic  *//
  22. //* action that is invoked when the parser performs a reduction by that rule.*//
  23. //*                                                                          *//
  24. //****************************************************************************//
  25. //****************************************************************************//
  26.  
  27.  
  28. //
  29. // Rule 1:  Goal -> CompilationUnit
  30. //
  31. #line 459 "java.g"
  32. //
  33. // Given a rule of the form A ::= x1 x2 ... xn        n >= 1
  34. //
  35. // Do nothing - Whatever Ast was produced for x1 is inherited by A.
  36. //
  37. void Parser::BadAction(void) { assert(false); }
  38. void Parser::NoAction(void) {}
  39.  
  40. //
  41. // Rule 2:  Goal ::= BodyMarker ConstructorBody
  42. //
  43. #line 471 "java.g"
  44. //
  45. // This rule was added to allow the parser to recognize the body of a
  46. // funtion (constructor or method, as the definition of the body of a
  47. // method is subsumed by the definition of the body of a constructor)
  48. // out of context. Note that the artificial terminal BodyMarker is
  49. // added here to prevent an ordinary parse from accepting a body as
  50. // a valid input - i.e., to recognize a body out-of-context, the
  51. // BodyMarker terminal must be inserted in front of the input stream
  52. // containing the body in question.
  53. //
  54. void Parser::Act2(void)
  55. {
  56.     Sym(1) = Sym(2);
  57. }
  58.  
  59. //
  60. // Rule 3:  Literal ::= IntegerLiteral
  61. //
  62. #line 496 "java.g"
  63. void Parser::Act3(void)
  64. {
  65.     Sym(1) = ast_pool -> NewIntegerLiteral(Token(1));
  66. }
  67.  
  68. //
  69. // Rule 4:  Literal ::= LongLiteral
  70. //
  71. #line 505 "java.g"
  72. void Parser::Act4(void)
  73. {
  74.     Sym(1) = ast_pool -> NewLongLiteral(Token(1));
  75. }
  76.  
  77. //
  78. // Rule 5:  Literal ::= FloatingPointLiteral
  79. //
  80. #line 514 "java.g"
  81. void Parser::Act5(void)
  82. {
  83.     Sym(1) = ast_pool -> NewFloatingPointLiteral(Token(1));
  84. }
  85.  
  86. //
  87. // Rule 6:  Literal ::= DoubleLiteral
  88. //
  89. #line 523 "java.g"
  90. void Parser::Act6(void)
  91. {
  92.     Sym(1) = ast_pool -> NewDoubleLiteral(Token(1));
  93. }
  94.  
  95. //
  96. // Rule 7:  Literal -> BooleanLiteral
  97. //
  98. // void NoAction(void);
  99. //
  100.  
  101. //
  102. // Rule 8:  Literal ::= CharacterLiteral
  103. //
  104. #line 536 "java.g"
  105. void Parser::Act8(void)
  106. {
  107.     Sym(1) = ast_pool -> NewCharacterLiteral(Token(1));
  108. }
  109.  
  110. //
  111. // Rule 9:  Literal ::= StringLiteral
  112. //
  113. #line 545 "java.g"
  114. void Parser::Act9(void)
  115. {
  116.     Sym(1) = ast_pool -> NewStringLiteral(Token(1));
  117. }
  118.  
  119. //
  120. // Rule 10:  Literal ::= null
  121. //
  122. #line 554 "java.g"
  123. void Parser::Act10(void)
  124. {
  125.     Sym(1) = ast_pool -> NewNullLiteral(Token(1));
  126. }
  127.  
  128. //
  129. // Rule 11:  BooleanLiteral ::= true
  130. //
  131. #line 563 "java.g"
  132. void Parser::Act11(void)
  133. {
  134.     Sym(1) = ast_pool -> NewTrueLiteral(Token(1));
  135. }
  136.  
  137. //
  138. // Rule 12:  BooleanLiteral ::= false
  139. //
  140. #line 572 "java.g"
  141. void Parser::Act12(void)
  142. {
  143.     Sym(1) = ast_pool -> NewFalseLiteral(Token(1));
  144. }
  145.  
  146. //
  147. // Rule 13:  Type -> PrimitiveType
  148. //
  149. // void NoAction(void);
  150. //
  151.  
  152. //
  153. // Rule 14:  Type -> ReferenceType
  154. //
  155. // void NoAction(void);
  156. //
  157.  
  158. //
  159. // Rule 15:  PrimitiveType -> NumericType
  160. //
  161. // void NoAction(void);
  162. //
  163.  
  164. //
  165. // Rule 16:  PrimitiveType ::= boolean
  166. //
  167. #line 595 "java.g"
  168. void Parser::Act16(void)
  169. {
  170.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BOOLEAN, Token(1));
  171. }
  172.  
  173. //
  174. // Rule 17:  NumericType -> IntegralType
  175. //
  176. // void NoAction(void);
  177. //
  178.  
  179. //
  180. // Rule 18:  NumericType -> FloatingPointType
  181. //
  182. // void NoAction(void);
  183. //
  184.  
  185. //
  186. // Rule 19:  IntegralType ::= byte
  187. //
  188. #line 612 "java.g"
  189. void Parser::Act19(void)
  190. {
  191.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BYTE, Token(1));
  192. }
  193.  
  194. //
  195. // Rule 20:  IntegralType ::= short
  196. //
  197. #line 621 "java.g"
  198. void Parser::Act20(void)
  199. {
  200.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::SHORT, Token(1));
  201. }
  202.  
  203. //
  204. // Rule 21:  IntegralType ::= int
  205. //
  206. #line 630 "java.g"
  207. void Parser::Act21(void)
  208. {
  209.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::INT, Token(1));
  210. }
  211.  
  212. //
  213. // Rule 22:  IntegralType ::= long
  214. //
  215. #line 639 "java.g"
  216. void Parser::Act22(void)
  217. {
  218.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::LONG, Token(1));
  219. }
  220.  
  221. //
  222. // Rule 23:  IntegralType ::= char
  223. //
  224. #line 648 "java.g"
  225. void Parser::Act23(void)
  226. {
  227.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::CHAR, Token(1));
  228. }
  229.  
  230. //
  231. // Rule 24:  FloatingPointType ::= float
  232. //
  233. #line 657 "java.g"
  234. void Parser::Act24(void)
  235. {
  236.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::FLOAT, Token(1));
  237. }
  238.  
  239. //
  240. // Rule 25:  FloatingPointType ::= double
  241. //
  242. #line 666 "java.g"
  243. void Parser::Act25(void)
  244. {
  245.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::DOUBLE, Token(1));
  246. }
  247.  
  248. //
  249. // Rule 26:  ReferenceType -> ClassOrInterfaceType
  250. //
  251. // void NoAction(void);
  252. //
  253.  
  254. //
  255. // Rule 27:  ReferenceType -> ArrayType
  256. //
  257. // void NoAction(void);
  258. //
  259.  
  260. //
  261. // Rule 28:  ClassOrInterfaceType -> Name
  262. //
  263. // void NoAction(void);
  264. //
  265.  
  266. //
  267. // Rule 29:  ArrayType ::= PrimitiveType Dims
  268. //
  269. #line 695 "java.g"
  270. void Parser::MakeArrayType(void)
  271. {
  272.     AstArrayType *p = ast_pool -> NewArrayType();
  273.     p -> type     = Sym(1);
  274.     //
  275.     // The list of modifiers is guaranteed not empty
  276.     //
  277.     {
  278.         AstListNode *tail = (AstListNode *) Sym(2);
  279.         p -> AllocateBrackets(tail -> index + 1);
  280.         AstListNode *root = tail;
  281.         do
  282.         {
  283.             root = root -> next;
  284.             p -> AddBrackets((AstBrackets *) root -> element);
  285.         } while(root != tail);
  286.         FreeCircularList(tail);
  287.     }
  288.     Sym(1) = p;
  289. }
  290.  
  291. //
  292. // Rule 30:  ArrayType ::= Name Dims
  293. //
  294. // void MakeArrayType(void);
  295. //
  296.  
  297. //
  298. // Rule 31:  ClassType -> ClassOrInterfaceType
  299. //
  300. // void NoAction(void);
  301. //
  302.  
  303. //
  304. // Rule 32:  InterfaceType -> ClassOrInterfaceType
  305. //
  306. // void NoAction(void);
  307. //
  308.  
  309. //
  310. // Rule 33:  Name -> SimpleName
  311. //
  312. // void NoAction(void);
  313. //
  314.  
  315. //
  316. // Rule 34:  Name -> QualifiedName
  317. //
  318. // void NoAction(void);
  319. //
  320.  
  321. //
  322. // Rule 35:  SimpleName ::= Identifier
  323. //
  324. #line 745 "java.g"
  325. void Parser::MakeSimpleName(void)
  326. {
  327.     Sym(1) = ast_pool -> NewSimpleName(Token(1));
  328. }
  329.  
  330. //
  331. // Rule 36:  QualifiedName ::= Name DOT Identifier
  332. //
  333. #line 754 "java.g"
  334. void Parser::MakeFieldAccess(void)
  335. {
  336.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  337.     p -> base = (AstExpression *) Sym(1);
  338.     p -> dot_token = Token(2);
  339.     p -> identifier_token = Token(3);
  340.     Sym(1) = p;
  341. }
  342.  
  343. //
  344. // Rule 37:  CompilationUnit ::= PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
  345. //
  346. #line 769 "java.g"
  347. void Parser::Act37(void)
  348. {
  349.     AstCompilationUnit *p = ast_pool -> NewCompilationUnit();
  350.     p -> package_declaration_opt = (AstPackageDeclaration *) Sym(1);
  351.     if (Sym(2) != NULL)
  352.     {
  353.         AstListNode *tail = (AstListNode *) Sym(2);
  354.         p -> AllocateImportDeclarations(tail -> index + 1);
  355.         AstListNode *root = tail;
  356.         do
  357.         {
  358.             root = root -> next;
  359.             p -> AddImportDeclaration((AstImportDeclaration *) root -> element);
  360.         } while(root != tail);
  361.         FreeCircularList(tail);
  362.     }
  363.     if (Sym(3) != NULL)
  364.     {
  365.         AstListNode *tail = (AstListNode *) Sym(3);
  366.         p -> AllocateTypeDeclarations(tail -> index + 1);
  367.         AstListNode *root = tail;
  368.         do
  369.         {
  370.             root = root -> next;
  371.             p -> AddTypeDeclaration(root -> element);
  372.         } while(root != tail);
  373.         FreeCircularList(tail);
  374.     }
  375.     Sym(1) = p;
  376. }
  377.  
  378. //
  379. // Rule 38:  ImportDeclarations ::= ImportDeclaration
  380. //
  381. #line 804 "java.g"
  382. //
  383. // Note that the list is circular so as to preserve the order of the elements
  384. //
  385. void Parser::Act38(void)
  386. {
  387.     AstListNode *p = AllocateListNode();
  388.     p -> next = p;
  389.     p -> element = Sym(1);
  390.     p -> index = 0;
  391.  
  392.     Sym(1) = p;
  393. }
  394.  
  395. //
  396. // Rule 39:  ImportDeclarations ::= ImportDeclarations ImportDeclaration
  397. //
  398. #line 821 "java.g"
  399. //
  400. // Note that the list is circular so as to preserve the order of the elements
  401. //
  402. void Parser::Act39(void)
  403. {
  404.     AstListNode *tail = (AstListNode *) Sym(1);
  405.  
  406.     AstListNode *p = AllocateListNode();
  407.     p -> element = Sym(2);
  408.     p -> index = tail -> index + 1;
  409.  
  410.     p -> next = tail -> next;
  411.     tail -> next = p;
  412.  
  413.     Sym(1) = p;
  414. }
  415.  
  416. //
  417. // Rule 40:  TypeDeclarations ::= TypeDeclaration
  418. //
  419. #line 842 "java.g"
  420. //
  421. // Note that the list is circular so as to preserve the order of the elements
  422. //
  423. void Parser::Act40(void)
  424. {
  425.     AstListNode *p = AllocateListNode();
  426.     p -> next = p;
  427.     p -> element = Sym(1);
  428.     p -> index = 0;
  429.  
  430.     Sym(1) = p;
  431. }
  432.  
  433. //
  434. // Rule 41:  TypeDeclarations ::= TypeDeclarations TypeDeclaration
  435. //
  436. #line 859 "java.g"
  437. //
  438. // Note that the list is circular so as to preserve the order of the elements
  439. //
  440. void Parser::Act41(void)
  441. {
  442.     AstListNode *tail = (AstListNode *) Sym(1);
  443.  
  444.     AstListNode *p = AllocateListNode();
  445.     p -> element = Sym(2);
  446.     p -> index = tail -> index + 1;
  447.  
  448.     p -> next = tail -> next;
  449.     tail -> next = p;
  450.  
  451.     Sym(1) = p;
  452. }
  453.  
  454. //
  455. // Rule 42:  PackageDeclaration ::= package Name PackageHeaderMarker SEMICOLON
  456. //
  457. #line 880 "java.g"
  458. void Parser::Act42(void)
  459. {
  460.     AstPackageDeclaration *p = ast_pool -> NewPackageDeclaration();
  461.     p -> package_token   = Token(1);
  462.     p -> name            = (AstExpression *) Sym(2);
  463.     p -> semicolon_token = Token(3);
  464.     Sym(1) = p;
  465. }
  466.  
  467. //
  468. // Rule 43:  ImportDeclaration -> SingleTypeImportDeclaration
  469. //
  470. // void NoAction(void);
  471. //
  472.  
  473. //
  474. // Rule 44:  ImportDeclaration -> TypeImportOnDemandDeclaration
  475. //
  476. // void NoAction(void);
  477. //
  478.  
  479. //
  480. // Rule 45:  SingleTypeImportDeclaration ::= import Name SEMICOLON
  481. //
  482. #line 901 "java.g"
  483. void Parser::Act45(void)
  484. {
  485.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  486.     p -> import_token    = Token(1);
  487.     p -> name            = (AstExpression *) Sym(2);
  488.     p -> star_token_opt  = 0;
  489.     p -> semicolon_token = Token(3);
  490.     Sym(1) = p;
  491. }
  492.  
  493. //
  494. // Rule 46:  TypeImportOnDemandDeclaration ::= import Name DOT MULTIPLY SEMICOLON
  495. //
  496. #line 915 "java.g"
  497. void Parser::Act46(void)
  498. {
  499.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  500.     p -> import_token         = Token(1);
  501.     p -> name                 = (AstExpression *) Sym(2);
  502.     p -> star_token_opt       = Token(4);
  503.     p -> semicolon_token      = Token(5);
  504.     Sym(1) = p;
  505. }
  506.  
  507. //
  508. // Rule 47:  TypeDeclaration -> ClassDeclaration
  509. //
  510. // void NoAction(void);
  511. //
  512.  
  513. //
  514. // Rule 48:  TypeDeclaration -> InterfaceDeclaration
  515. //
  516. // void NoAction(void);
  517. //
  518.  
  519. //
  520. // Rule 49:  TypeDeclaration ::= SEMICOLON
  521. //
  522. #line 937 "java.g"
  523. void Parser::Act49(void)
  524. {
  525.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  526. }
  527.  
  528. //
  529. // Rule 50:  Modifiers ::= Modifier
  530. //
  531. #line 948 "java.g"
  532. //
  533. // Note that the list is circular so as to preserve the order of the elements
  534. //
  535. void Parser::Act50(void)
  536. {
  537.     AstListNode *p = AllocateListNode();
  538.     p -> next = p;
  539.     p -> element = Sym(1);
  540.     p -> index = 0;
  541.  
  542.     Sym(1) = p;
  543. }
  544.  
  545. //
  546. // Rule 51:  Modifiers ::= Modifiers Modifier
  547. //
  548. #line 965 "java.g"
  549. //
  550. // Note that the list is circular so as to preserve the order of the elements
  551. //
  552. void Parser::Act51(void)
  553. {
  554.     AstListNode *tail = (AstListNode *) Sym(1);
  555.  
  556.     AstListNode *p = AllocateListNode();
  557.     p -> element = Sym(2);
  558.     p -> index = tail -> index + 1;
  559.  
  560.     p -> next = tail -> next;
  561.     tail -> next = p;
  562.  
  563.     Sym(1) = p;
  564. }
  565.  
  566. //
  567. // Rule 52:  Modifier ::= public
  568. //
  569. #line 986 "java.g"
  570. void Parser::Act52(void)
  571. {
  572.     Sym(1) = ast_pool -> NewModifier(Ast::PUBLIC, Token(1));
  573. }
  574.  
  575. //
  576. // Rule 53:  Modifier ::= protected
  577. //
  578. #line 995 "java.g"
  579. void Parser::Act53(void)
  580. {
  581.     Sym(1) = ast_pool -> NewModifier(Ast::PROTECTED, Token(1));
  582. }
  583.  
  584. //
  585. // Rule 54:  Modifier ::= private
  586. //
  587. #line 1004 "java.g"
  588. void Parser::Act54(void)
  589. {
  590.     Sym(1) = ast_pool -> NewModifier(Ast::PRIVATE, Token(1));
  591. }
  592.  
  593. //
  594. // Rule 55:  Modifier ::= static
  595. //
  596. #line 1013 "java.g"
  597. void Parser::Act55(void)
  598. {
  599.     Sym(1) = ast_pool -> NewModifier(Ast::STATIC, Token(1));
  600. }
  601.  
  602. //
  603. // Rule 56:  Modifier ::= abstract
  604. //
  605. #line 1022 "java.g"
  606. void Parser::Act56(void)
  607. {
  608.     Sym(1) = ast_pool -> NewModifier(Ast::ABSTRACT, Token(1));
  609. }
  610.  
  611. //
  612. // Rule 57:  Modifier ::= final
  613. //
  614. #line 1031 "java.g"
  615. void Parser::Act57(void)
  616. {
  617.     Sym(1) = ast_pool -> NewModifier(Ast::FINAL, Token(1));
  618. }
  619.  
  620. //
  621. // Rule 58:  Modifier ::= native
  622. //
  623. #line 1040 "java.g"
  624. void Parser::Act58(void)
  625. {
  626.     Sym(1) = ast_pool -> NewModifier(Ast::NATIVE, Token(1));
  627. }
  628.  
  629. //
  630. // Rule 59:  Modifier ::= strictfp
  631. //
  632. #line 1049 "java.g"
  633. void Parser::Act59(void)
  634. {
  635.     Sym(1) = ast_pool -> NewModifier(Ast::STRICTFP, Token(1));
  636. }
  637.  
  638. //
  639. // Rule 60:  Modifier ::= synchronized
  640. //
  641. #line 1058 "java.g"
  642. void Parser::Act60(void)
  643. {
  644.     Sym(1) = ast_pool -> NewModifier(Ast::SYNCHRONIZED, Token(1));
  645. }
  646.  
  647. //
  648. // Rule 61:  Modifier ::= transient
  649. //
  650. #line 1067 "java.g"
  651. void Parser::Act61(void)
  652. {
  653.     Sym(1) = ast_pool -> NewModifier(Ast::TRANSIENT, Token(1));
  654. }
  655.  
  656. //
  657. // Rule 62:  Modifier ::= volatile
  658. //
  659. #line 1076 "java.g"
  660. void Parser::Act62(void)
  661. {
  662.     Sym(1) = ast_pool -> NewModifier(Ast::VOLATILE, Token(1));
  663. }
  664.  
  665. //
  666. // Rule 63:  ClassDeclaration ::= Modifiersopt class Identifier Superopt Interfacesopt ClassBody
  667. //
  668. #line 1092 "java.g"
  669. void Parser::Act63(void)
  670. {
  671.     AstClassDeclaration *p = ast_pool -> NewClassDeclaration();
  672.     if (Sym(1) != NULL)
  673.     {
  674.         AstListNode *tail = (AstListNode *) Sym(1);
  675.         p -> AllocateClassModifiers(tail -> index + 1);
  676.         AstListNode *root = tail;
  677.         do
  678.         {
  679.             root = root -> next;
  680.             p -> AddClassModifier((AstModifier *) root -> element);
  681.         } while(root != tail);
  682.         FreeCircularList(tail);
  683.     }
  684.     p -> class_token          = Token(2);
  685.     p -> identifier_token     = Token(3);
  686.     p -> super_opt            = (AstExpression *) Sym(4);
  687.     if (Sym(5) != NULL)
  688.     {
  689.         AstListNode *tail = (AstListNode *) Sym(5);
  690.         p -> AllocateInterfaces(tail -> index + 1);
  691.         AstListNode *root = tail;
  692.         do
  693.         {
  694.             root = root -> next;
  695.             p -> AddInterface((AstExpression *) root -> element);
  696.         } while(root != tail);
  697.         FreeCircularList(tail);
  698.     }
  699.     p -> class_body = (AstClassBody *) Sym(6);
  700.     Sym(1) = p;
  701. }
  702.  
  703. //
  704. // Rule 64:  Super ::= extends ClassType
  705. //
  706. #line 1130 "java.g"
  707. void Parser::SetSym1ToSym2(void) { Sym(1) = Sym(2); }
  708.  
  709. //
  710. // Rule 65:  Interfaces ::= implements InterfaceTypeList
  711. //
  712. // void SetSym1ToSym2(void);
  713. //
  714.  
  715. //
  716. // Rule 66:  InterfaceTypeList ::= InterfaceType
  717. //
  718. #line 1143 "java.g"
  719. //
  720. // Note that the list is circular so as to preserve the order of the elements
  721. //
  722. void Parser::Act66(void)
  723. {
  724.     AstListNode *p = AllocateListNode();
  725.     p -> next = p;
  726.     p -> element = Sym(1);
  727.     p -> index = 0;
  728.  
  729.     Sym(1) = p;
  730. }
  731.  
  732. //
  733. // Rule 67:  InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType
  734. //
  735. #line 1160 "java.g"
  736. //
  737. // Note that the list is circular so as to preserve the order of the elements
  738. //
  739. void Parser::Act67(void)
  740. {
  741.     AstListNode *tail = (AstListNode *) Sym(1);
  742.  
  743.     AstListNode *p = AllocateListNode();
  744.     p -> element = Sym(3);
  745.     p -> index = tail -> index + 1;
  746.  
  747.     p -> next = tail -> next;
  748.     tail -> next = p;
  749.  
  750.     Sym(1) = p;
  751. }
  752.  
  753. //
  754. // Rule 68:  ClassBody ::= LBRACE ClassBodyDeclarationsopt RBRACE
  755. //
  756. #line 1181 "java.g"
  757. void Parser::Act68(void)
  758. {
  759.     AstClassBody *p = ast_pool -> NewClassBody();
  760.     if (parse_header_only)
  761.         p -> mark_unparsed();
  762.  
  763.     p -> left_brace_token = Token(1);
  764.     if (Sym(2) != NULL)
  765.     {
  766.         int num_instance_variables = 0,
  767.             num_class_variables = 0,
  768.             num_methods = 0,
  769.             num_constructors = 0,
  770.             num_static_initializers = 0,
  771.             num_inner_classes = 0,
  772.             num_inner_interfaces = 0,
  773.             num_blocks = 0,
  774.             num_empty_declarations = 0;
  775.  
  776.         AstListNode *tail = (AstListNode *) Sym(2);
  777.         p -> AllocateClassBodyDeclarations(tail -> index + 1);
  778.         AstListNode *root = tail;
  779.         do
  780.         {
  781.             root = root -> next;
  782.             p -> AddClassBodyDeclaration(root -> element);
  783.  
  784.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  785.             if (field_declaration)
  786.             {
  787.                 for (int i = 0; i < field_declaration -> NumVariableModifiers(); i++)
  788.                 {
  789.                     if (field_declaration -> VariableModifier(i) -> kind == Ast::STATIC)
  790.                     {
  791.                         field_declaration -> MarkStatic();
  792.                         break;
  793.                     }
  794.                 }
  795.                 if (field_declaration -> StaticFieldCast())
  796.                      num_class_variables++;
  797.                 else num_instance_variables++;
  798.             }
  799.             else if (root -> element -> MethodDeclarationCast())
  800.             {
  801.                 num_methods++;
  802.             }
  803.             else if (root -> element -> ConstructorDeclarationCast())
  804.             {
  805.                 num_constructors++;
  806.             }
  807.             else if (root -> element -> StaticInitializerCast())
  808.             {
  809.                 num_static_initializers++;
  810.             }
  811.             else if (root -> element -> ClassDeclarationCast())
  812.             {
  813.                 num_inner_classes++;
  814.             }
  815.             else if (root -> element -> InterfaceDeclarationCast())
  816.             {
  817.                 num_inner_interfaces++;
  818.             }
  819.             else if (root -> element -> BlockCast())
  820.             {
  821.                 num_blocks++;
  822.             }
  823.             else num_empty_declarations++;
  824.         } while(root != tail);
  825.  
  826.         p -> AllocateInstanceVariables(num_instance_variables);
  827.         p -> AllocateClassVariables(num_class_variables);
  828.         p -> AllocateMethods(num_methods);
  829.         p -> AllocateConstructors(num_constructors);
  830.         p -> AllocateStaticInitializers(num_static_initializers);
  831.         p -> AllocateNestedClasses(num_inner_classes);
  832.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  833.         p -> AllocateBlocks(num_blocks);
  834.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  835.  
  836.         root = tail;
  837.         do
  838.         {
  839.             root = root -> next;
  840.  
  841.             AstFieldDeclaration *field_declaration;
  842.             AstMethodDeclaration *method_declaration;
  843.             AstConstructorDeclaration *constructor_declaration;
  844.             AstStaticInitializer *static_initializer;
  845.             AstClassDeclaration *class_declaration;
  846.             AstInterfaceDeclaration *interface_declaration;
  847.             AstBlock *block;
  848.  
  849.             if (field_declaration = root -> element -> FieldDeclarationCast())
  850.             {
  851.                 if (field_declaration -> StaticFieldCast())
  852.                      p -> AddClassVariable(field_declaration);
  853.                 else p -> AddInstanceVariable(field_declaration);
  854.             }
  855.             else if (method_declaration = root -> element -> MethodDeclarationCast())
  856.             {
  857.                 p -> AddMethod(method_declaration);
  858.             }
  859.             else if (constructor_declaration = root -> element -> ConstructorDeclarationCast())
  860.             {
  861.                 p -> AddConstructor(constructor_declaration);
  862.             }
  863.             else if (static_initializer = root -> element -> StaticInitializerCast())
  864.             {
  865.                 p -> AddStaticInitializer(static_initializer);
  866.             }
  867.             else if (class_declaration = root -> element -> ClassDeclarationCast())
  868.             {
  869.                 p -> AddNestedClass(class_declaration);
  870.             }
  871.             else if (interface_declaration = root -> element -> InterfaceDeclarationCast())
  872.             {
  873.                 p -> AddNestedInterface(interface_declaration);
  874.             }
  875.             else if (block = root -> element -> BlockCast())
  876.             {
  877.                 p -> AddBlock(block);
  878.             }
  879.             else // assert(block = root -> element -> EmptyDeclarationCast())
  880.             {
  881.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  882.             }
  883.         } while(root != tail);
  884.         FreeCircularList(tail);
  885.     }
  886.     p -> right_brace_token = Token(3);
  887.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  888.     Sym(1) = p;
  889. }
  890.  
  891. //
  892. // Rule 69:  ClassBodyDeclarations ::= ClassBodyDeclaration
  893. //
  894. #line 1319 "java.g"
  895. //
  896. // Note that the list is circular so as to preserve the order of the elements
  897. //
  898. void Parser::Act69(void)
  899. {
  900.     AstListNode *p = AllocateListNode();
  901.     p -> next = p;
  902.     p -> element = Sym(1);
  903.     p -> index = 0;
  904.  
  905.     Sym(1) = p;
  906. }
  907.  
  908. //
  909. // Rule 70:  ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
  910. //
  911. #line 1336 "java.g"
  912. //
  913. // Note that the list is circular so as to preserve the order of the elements
  914. //
  915. void Parser::Act70(void)
  916. {
  917.     AstListNode *tail = (AstListNode *) Sym(1);
  918.  
  919.     AstListNode *p = AllocateListNode();
  920.     p -> element = Sym(2);
  921.     p -> index = tail -> index + 1;
  922.  
  923.     p -> next = tail -> next;
  924.     tail -> next = p;
  925.  
  926.     Sym(1) = p;
  927. }
  928.  
  929. //
  930. // Rule 71:  ClassBodyDeclaration -> ClassMemberDeclaration
  931. //
  932. // void NoAction(void);
  933. //
  934.  
  935. //
  936. // Rule 72:  ClassBodyDeclaration -> StaticInitializer
  937. //
  938. // void NoAction(void);
  939. //
  940.  
  941. //
  942. // Rule 73:  ClassBodyDeclaration -> ConstructorDeclaration
  943. //
  944. // void NoAction(void);
  945. //
  946.  
  947. //
  948. // Rule 74:  ClassBodyDeclaration ::= MethodHeaderMarker Block
  949. //
  950. #line 1370 "java.g"
  951. void Parser::Act74(void)
  952. {
  953.     Sym(1) = Sym(2);
  954. }
  955.  
  956. //
  957. // Rule 75:  ClassMemberDeclaration -> FieldDeclaration
  958. //
  959. // void NoAction(void);
  960. //
  961.  
  962. //
  963. // Rule 76:  ClassMemberDeclaration -> MethodDeclaration
  964. //
  965. // void NoAction(void);
  966. //
  967.  
  968. //
  969. // Rule 77:  ClassMemberDeclaration -> ClassDeclaration
  970. //
  971. // void NoAction(void);
  972. //
  973.  
  974. //
  975. // Rule 78:  ClassMemberDeclaration -> InterfaceDeclaration
  976. //
  977. // void NoAction(void);
  978. //
  979.  
  980. //
  981. // Rule 79:  ClassMemberDeclaration ::= SEMICOLON
  982. //
  983. #line 1404 "java.g"
  984. void Parser::Act79(void)
  985. {
  986.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  987. }
  988.  
  989. //
  990. // Rule 80:  FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON
  991. //
  992. #line 1423 "java.g"
  993. void Parser::Act80(void)
  994. {
  995.     AstFieldDeclaration *p = ast_pool -> NewFieldDeclaration();
  996.     if (Sym(1) != NULL)
  997.     {
  998.         AstListNode *tail = (AstListNode *) Sym(1);
  999.         p -> AllocateVariableModifiers(tail -> index + 1);
  1000.         AstListNode *root = tail;
  1001.         do
  1002.         {
  1003.             root = root -> next;
  1004.             p -> AddVariableModifier((AstModifier *) root -> element);
  1005.         } while(root != tail);
  1006.         FreeCircularList(tail);
  1007.     }
  1008.     p -> type = Sym(2);
  1009.     //
  1010.     // The list of declarators is guaranteed not empty
  1011.     //
  1012.     {
  1013.         AstListNode *tail = (AstListNode *) Sym(3);
  1014.         p -> AllocateVariableDeclarators(tail -> index + 1);
  1015.         AstListNode *root = tail;
  1016.         do
  1017.         {
  1018.             root = root -> next;
  1019.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  1020.         } while(root != tail);
  1021.         FreeCircularList(tail);
  1022.     }
  1023.     p -> semicolon_token      = Token(4);
  1024.     Sym(1) = p;
  1025. }
  1026.  
  1027. //
  1028. // Rule 81:  VariableDeclarators ::= VariableDeclarator
  1029. //
  1030. #line 1461 "java.g"
  1031. //
  1032. // Note that the list is circular so as to preserve the order of the elements
  1033. //
  1034. void Parser::Act81(void)
  1035. {
  1036.     AstListNode *p = AllocateListNode();
  1037.     p -> next = p;
  1038.     p -> element = Sym(1);
  1039.     p -> index = 0;
  1040.  
  1041.     Sym(1) = p;
  1042. }
  1043.  
  1044. //
  1045. // Rule 82:  VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator
  1046. //
  1047. #line 1478 "java.g"
  1048. //
  1049. // Note that the list is circular so as to preserve the order of the elements
  1050. //
  1051. void Parser::Act82(void)
  1052. {
  1053.     AstListNode *tail = (AstListNode *) Sym(1);
  1054.  
  1055.     AstListNode *p = AllocateListNode();
  1056.     p -> element = Sym(3);
  1057.     p -> index = tail -> index + 1;
  1058.  
  1059.     p -> next = tail -> next;
  1060.     tail -> next = p;
  1061.  
  1062.     Sym(1) = p;
  1063. }
  1064.  
  1065. //
  1066. // Rule 83:  VariableDeclarator ::= VariableDeclaratorId
  1067. //
  1068. #line 1499 "java.g"
  1069. void Parser::Act83(void)
  1070. {
  1071.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1072.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1073.     p -> variable_initializer_opt = NULL;
  1074.     Sym(1) = p;
  1075. }
  1076.  
  1077. //
  1078. // Rule 84:  VariableDeclarator ::= VariableDeclaratorId EQUAL VariableInitializer
  1079. //
  1080. #line 1511 "java.g"
  1081. void Parser::Act84(void)
  1082. {
  1083.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1084.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1085.     p -> variable_initializer_opt = Sym(3);
  1086.     Sym(1) = p;
  1087. }
  1088.  
  1089. //
  1090. // Rule 85:  VariableDeclaratorId ::= Identifier Dimsopt
  1091. //
  1092. #line 1523 "java.g"
  1093. void Parser::Act85(void)
  1094. {
  1095.     AstVariableDeclaratorId *p = ast_pool -> NewVariableDeclaratorId();
  1096.     p -> identifier_token = Token(1);
  1097.     if (Sym(2) != NULL)
  1098.     {
  1099.         AstListNode *tail = (AstListNode *) Sym(2);
  1100.         p -> AllocateBrackets(tail -> index + 1);
  1101.         AstListNode *root = tail;
  1102.         do
  1103.         {
  1104.             root = root -> next;
  1105.             p -> AddBrackets((AstBrackets *) root -> element);
  1106.         } while(root != tail);
  1107.         FreeCircularList(tail);
  1108.     }
  1109.     Sym(1) = p;
  1110. }
  1111.  
  1112. //
  1113. // Rule 86:  VariableInitializer -> Expression
  1114. //
  1115. // void NoAction(void);
  1116. //
  1117.  
  1118. //
  1119. // Rule 87:  VariableInitializer -> ArrayInitializer
  1120. //
  1121. // void NoAction(void);
  1122. //
  1123.  
  1124. //
  1125. // Rule 88:  MethodDeclaration ::= MethodHeader MethodHeaderMarker MethodBody
  1126. //
  1127. #line 1571 "java.g"
  1128. void Parser::Act88(void)
  1129. {
  1130.     ((AstMethodDeclaration *) Sym(1)) -> method_body = (AstStatement *) Sym(3);
  1131. }
  1132.  
  1133. //
  1134. // Rule 89:  MethodHeader ::= Modifiersopt Type MethodDeclarator Throwsopt
  1135. //
  1136. #line 1580 "java.g"
  1137. void Parser::Act89(void)
  1138. {
  1139.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1140.     if (Sym(1) != NULL)
  1141.     {
  1142.         AstListNode *tail = (AstListNode *) Sym(1);
  1143.         p -> AllocateMethodModifiers(tail -> index + 1);
  1144.         AstListNode *root = tail;
  1145.         do
  1146.         {
  1147.             root = root -> next;
  1148.             p -> AddMethodModifier((AstModifier *) root -> element);
  1149.         } while(root != tail);
  1150.         FreeCircularList(tail);
  1151.     }
  1152.     p -> type              = Sym(2);
  1153.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1154.     if (Sym(4) != NULL)
  1155.     {
  1156.         AstListNode *tail = (AstListNode *) Sym(4);
  1157.         p -> AllocateThrows(tail -> index + 1);
  1158.         AstListNode *root = tail;
  1159.         do
  1160.         {
  1161.             root = root -> next;
  1162.             p -> AddThrow((AstExpression *) root -> element);
  1163.         } while(root != tail);
  1164.         FreeCircularList(tail);
  1165.     }
  1166.     Sym(1) = p;
  1167. }
  1168.  
  1169. //
  1170. // Rule 90:  MethodHeader ::= Modifiersopt void MethodDeclarator Throwsopt
  1171. //
  1172. #line 1616 "java.g"
  1173. void Parser::Act90(void)
  1174. {
  1175.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1176.     if (Sym(1) != NULL)
  1177.     {
  1178.         AstListNode *tail = (AstListNode *) Sym(1);
  1179.         p -> AllocateMethodModifiers(tail -> index + 1);
  1180.         AstListNode *root = tail;
  1181.         do
  1182.         {
  1183.             root = root -> next;
  1184.             p -> AddMethodModifier((AstModifier *) root -> element);
  1185.         } while(root != tail);
  1186.         FreeCircularList(tail);
  1187.     }
  1188.     p -> type              = ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(2));
  1189.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1190.     if (Sym(4) != NULL)
  1191.     {
  1192.         AstListNode *tail = (AstListNode *) Sym(4);
  1193.         p -> AllocateThrows(tail -> index + 1);
  1194.         AstListNode *root = tail;
  1195.         do
  1196.         {
  1197.             root = root -> next;
  1198.             p -> AddThrow((AstExpression *) root -> element);
  1199.         } while(root != tail);
  1200.         FreeCircularList(tail);
  1201.     }
  1202.     Sym(1) = p;
  1203. }
  1204.  
  1205. //
  1206. // Rule 91:  MethodDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN Dimsopt
  1207. //
  1208. #line 1652 "java.g"
  1209. void Parser::Act91(void)
  1210. {
  1211.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1212.     p -> identifier_token        = Token(1);
  1213.     p -> left_parenthesis_token  = Token(2);
  1214.     if (Sym(3) != NULL)
  1215.     {
  1216.         AstListNode *tail = (AstListNode *) Sym(3);
  1217.         p -> AllocateFormalParameters(tail -> index + 1);
  1218.         AstListNode *root = tail;
  1219.         do
  1220.         {
  1221.             root = root -> next;
  1222.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1223.         } while(root != tail);
  1224.         FreeCircularList(tail);
  1225.     }
  1226.     p -> right_parenthesis_token = Token(4);
  1227.     if (Sym(5) != NULL)
  1228.     {
  1229.         AstListNode *tail = (AstListNode *) Sym(5);
  1230.         p -> AllocateBrackets(tail -> index + 1);
  1231.         AstListNode *root = tail;
  1232.         do
  1233.         {
  1234.             root = root -> next;
  1235.             p -> AddBrackets((AstBrackets *) root -> element);
  1236.         } while(root != tail);
  1237.         FreeCircularList(tail);
  1238.     }
  1239.     Sym(1) = p;
  1240. }
  1241.  
  1242. //
  1243. // Rule 92:  FormalParameterList ::= FormalParameter
  1244. //
  1245. #line 1689 "java.g"
  1246. //
  1247. // Note that the list is circular so as to preserve the order of the elements
  1248. //
  1249. void Parser::Act92(void)
  1250. {
  1251.     AstListNode *p = AllocateListNode();
  1252.     p -> next = p;
  1253.     p -> element = Sym(1);
  1254.     p -> index = 0;
  1255.  
  1256.     Sym(1) = p;
  1257. }
  1258.  
  1259. //
  1260. // Rule 93:  FormalParameterList ::= FormalParameterList COMMA FormalParameter
  1261. //
  1262. #line 1706 "java.g"
  1263. //
  1264. // Note that the list is circular so as to preserve the order of the elements
  1265. //
  1266. void Parser::Act93(void)
  1267. {
  1268.     AstListNode *tail = (AstListNode *) Sym(1);
  1269.  
  1270.     AstListNode *p = AllocateListNode();
  1271.     p -> element = Sym(3);
  1272.     p -> index = tail -> index + 1;
  1273.  
  1274.     p -> next = tail -> next;
  1275.     tail -> next = p;
  1276.  
  1277.     Sym(1) = p;
  1278. }
  1279.  
  1280. //
  1281. // Rule 94:  FormalParameter ::= Type VariableDeclaratorId
  1282. //
  1283. #line 1727 "java.g"
  1284. void Parser::Act94(void)
  1285. {
  1286.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1287.     p -> type = Sym(1);
  1288.  
  1289.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1290.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(2);
  1291.     formal_declarator -> variable_initializer_opt = NULL;
  1292.  
  1293.     p -> formal_declarator = formal_declarator;
  1294.  
  1295.     Sym(1) = p;
  1296. }
  1297.  
  1298. //
  1299. // Rule 95:  FormalParameter ::= Modifiers Type VariableDeclaratorId
  1300. //
  1301. #line 1746 "java.g"
  1302. void Parser::Act95(void)
  1303. {
  1304.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1305.     //
  1306.     // The list of modifiers is guaranteed not empty
  1307.     //
  1308.     {
  1309.         AstListNode *tail = (AstListNode *) Sym(1);
  1310.         p -> AllocateParameterModifiers(tail -> index + 1);
  1311.         AstListNode *root = tail;
  1312.         do
  1313.         {
  1314.             root = root -> next;
  1315.             p -> AddParameterModifier((AstModifier *) root -> element);
  1316.         } while(root != tail);
  1317.         FreeCircularList(tail);
  1318.     }
  1319.  
  1320.     p -> type = Sym(2);
  1321.  
  1322.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1323.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(3);
  1324.     formal_declarator -> variable_initializer_opt = NULL;
  1325.  
  1326.     p -> formal_declarator = formal_declarator;
  1327.  
  1328.     Sym(1) = p;
  1329. }
  1330.  
  1331. //
  1332. // Rule 96:  Throws ::= throws ClassTypeList
  1333. //
  1334. // void SetSym1ToSym2(void);
  1335. //
  1336.  
  1337. //
  1338. // Rule 97:  ClassTypeList ::= ClassType
  1339. //
  1340. #line 1786 "java.g"
  1341. //
  1342. // Note that the list is circular so as to preserve the order of the elements
  1343. //
  1344. void Parser::Act97(void)
  1345. {
  1346.     AstListNode *p = AllocateListNode();
  1347.     p -> next = p;
  1348.     p -> element = Sym(1);
  1349.     p -> index = 0;
  1350.  
  1351.     Sym(1) = p;
  1352. }
  1353.  
  1354. //
  1355. // Rule 98:  ClassTypeList ::= ClassTypeList COMMA ClassType
  1356. //
  1357. #line 1803 "java.g"
  1358. //
  1359. // Note that the list is circular so as to preserve the order of the elements
  1360. //
  1361. void Parser::Act98(void)
  1362. {
  1363.     AstListNode *tail = (AstListNode *) Sym(1);
  1364.  
  1365.     AstListNode *p = AllocateListNode();
  1366.     p -> element = Sym(3);
  1367.     p -> index = tail -> index + 1;
  1368.  
  1369.     p -> next = tail -> next;
  1370.     tail -> next = p;
  1371.  
  1372.     Sym(1) = p;
  1373. }
  1374.  
  1375. //
  1376. // Rule 99:  MethodBody -> Block
  1377. //
  1378. // void NoAction(void);
  1379. //
  1380.  
  1381. //
  1382. // Rule 100:  MethodBody ::= SEMICOLON
  1383. //
  1384. #line 1828 "java.g"
  1385. void Parser::MakeEmptyStatement(void)
  1386. {
  1387.     Sym(1) = ast_pool -> NewEmptyStatement(Token(1));
  1388. }
  1389.  
  1390. //
  1391. // Rule 101:  StaticInitializer ::= static MethodHeaderMarker Block
  1392. //
  1393. #line 1839 "java.g"
  1394. void Parser::Act101(void)
  1395. {
  1396.     AstStaticInitializer *p = ast_pool -> NewStaticInitializer();
  1397.     p -> static_token = Token(1);
  1398.     p -> block        = (AstBlock *) Sym(3);
  1399.     Sym(1) = p;
  1400. }
  1401.  
  1402. //
  1403. // Rule 102:  ConstructorDeclaration ::= Modifiersopt ConstructorDeclarator Throwsopt MethodHeaderMarker ConstructorBody
  1404. //
  1405. #line 1864 "java.g"
  1406. void Parser::Act102(void)
  1407. {
  1408.     AstConstructorBlock *block = Sym(5) -> ConstructorBlockCast();
  1409.     if (! block)
  1410.     {
  1411.         block = ast_pool -> NewConstructorBlock();
  1412.         block -> left_brace_token                    = Sym(5) -> LeftToken();
  1413.         block -> explicit_constructor_invocation_opt = NULL;
  1414.         block -> block                               = (AstBlock *) Sym(5);
  1415.         block -> right_brace_token                   = Sym(5) -> RightToken();
  1416.     }
  1417.  
  1418.     AstConstructorDeclaration *p = ast_pool -> NewConstructorDeclaration();
  1419.  
  1420.     if (Sym(1) != NULL)
  1421.     {
  1422.         AstListNode *tail = (AstListNode *) Sym(1);
  1423.         p -> AllocateConstructorModifiers(tail -> index + 1);
  1424.         AstListNode *root = tail;
  1425.         do
  1426.         {
  1427.             root = root -> next;
  1428.             p -> AddConstructorModifier((AstModifier *) root -> element);
  1429.         } while(root != tail);
  1430.         FreeCircularList(tail);
  1431.     }
  1432.     p -> constructor_declarator = (AstMethodDeclarator *) Sym(2);
  1433.     if (Sym(3) != NULL)
  1434.     {
  1435.         AstListNode *tail = (AstListNode *) Sym(3);
  1436.         p -> AllocateThrows(tail -> index + 1);
  1437.         AstListNode *root = tail;
  1438.         do
  1439.         {
  1440.             root = root -> next;
  1441.             p -> AddThrow((AstExpression *) root -> element);
  1442.         } while(root != tail);
  1443.         FreeCircularList(tail);
  1444.     }
  1445.     p -> constructor_body       = block;
  1446.  
  1447.     Sym(1) = p;
  1448. }
  1449.  
  1450. //
  1451. // Rule 103:  ConstructorDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN
  1452. //
  1453. #line 1920 "java.g"
  1454. void Parser::Act103(void)
  1455. {
  1456.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1457.     p -> identifier_token        = Token(1);
  1458.     p -> left_parenthesis_token  = Token(2);
  1459.     if (Sym(3) != NULL)
  1460.     {
  1461.         AstListNode *tail = (AstListNode *) Sym(3);
  1462.         p -> AllocateFormalParameters(tail -> index + 1);
  1463.         AstListNode *root = tail;
  1464.         do
  1465.         {
  1466.             root = root -> next;
  1467.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1468.         } while(root != tail);
  1469.         FreeCircularList(tail);
  1470.     }
  1471.     p -> right_parenthesis_token = Token(4);
  1472.     Sym(1) = p;
  1473. }
  1474.  
  1475. //
  1476. // Rule 104:  ConstructorBody -> Block
  1477. //
  1478. // void NoAction(void);
  1479. //
  1480.  
  1481. //
  1482. // Rule 105:  ConstructorBody ::= LBRACE ExplicitConstructorInvocation BlockStatementsopt RBRACE
  1483. //
  1484. #line 1955 "java.g"
  1485. void Parser::Act105(void)
  1486. {
  1487.     AstBlock *block = ast_pool -> NewBlock();
  1488.     if (Sym(3) != NULL)
  1489.     {
  1490.         AstListNode *tail = (AstListNode *) Sym(3);
  1491.         block -> AllocateBlockStatements(tail -> index + 1);
  1492.         AstListNode *root = tail;
  1493.         block -> left_brace_token  = root -> element -> LeftToken();
  1494.         block -> right_brace_token = tail -> element -> RightToken();
  1495.         do
  1496.         {
  1497.             root = root -> next;
  1498.             block -> AddStatement((AstStatement *) root -> element);
  1499.         } while(root != tail);
  1500.         FreeCircularList(tail);
  1501.     }
  1502.     else
  1503.     {
  1504.         block -> left_brace_token  = Token(4);
  1505.         block -> right_brace_token = Token(4);
  1506.     }
  1507.  
  1508.     AstConstructorBlock *p = ast_pool -> NewConstructorBlock();
  1509.     p -> left_brace_token                    = Token(1);
  1510.     p -> explicit_constructor_invocation_opt = Sym(2);
  1511.     p -> block                               = block;
  1512.     p -> right_brace_token                   = Token(4);
  1513.     Sym(1) = p;
  1514. }
  1515.  
  1516. //
  1517. // Rule 106:  ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN SEMICOLON
  1518. //
  1519. #line 1990 "java.g"
  1520. void Parser::Act106(void)
  1521. {
  1522.     AstThisCall *p = ast_pool -> NewThisCall();
  1523.     p -> base_opt                = NULL;
  1524.     p -> dot_token_opt           = 0;
  1525.     p -> this_token              = Token(1);
  1526.     p -> left_parenthesis_token  = Token(2);
  1527.     if (Sym(3) != NULL)
  1528.     {
  1529.         AstListNode *tail = (AstListNode *) Sym(3);
  1530.         p -> AllocateArguments(tail -> index + 1);
  1531.         AstListNode *root = tail;
  1532.         do
  1533.         {
  1534.             root = root -> next;
  1535.             p -> AddArgument((AstExpression *) root -> element);
  1536.         } while(root != tail);
  1537.         FreeCircularList(tail);
  1538.     }
  1539.     p -> right_parenthesis_token = Token(4);
  1540.     p -> semicolon_token         = Token(5);
  1541.     Sym(1) = p;
  1542. }
  1543.  
  1544. //
  1545. // Rule 107:  ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt RPAREN SEMICOLON
  1546. //
  1547. #line 2018 "java.g"
  1548. void Parser::Act107(void)
  1549. {
  1550.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1551.     p -> base_opt                = NULL;
  1552.     p -> dot_token_opt           = 0;
  1553.     p -> super_token             = Token(1);
  1554.     p -> left_parenthesis_token  = Token(2);
  1555.     if (Sym(3) != NULL)
  1556.     {
  1557.         AstListNode *tail = (AstListNode *) Sym(3);
  1558.         p -> AllocateArguments(tail -> index + 1);
  1559.         AstListNode *root = tail;
  1560.         do
  1561.         {
  1562.             root = root -> next;
  1563.             p -> AddArgument((AstExpression *) root -> element);
  1564.         } while(root != tail);
  1565.         FreeCircularList(tail);
  1566.     }
  1567.     p -> right_parenthesis_token = Token(4);
  1568.     p -> semicolon_token         = Token(5);
  1569.     Sym(1) = p;
  1570. }
  1571.  
  1572. //
  1573. // Rule 108:  ExplicitConstructorInvocation ::= Primary DOT this LPAREN ArgumentListopt RPAREN SEMICOLON
  1574. //
  1575. #line 2047 "java.g"
  1576. void Parser::Act108(void)
  1577. {
  1578.     AstThisCall *p = ast_pool -> NewThisCall();
  1579.     p -> base_opt               = (AstExpression *) Sym(1);
  1580.     p -> dot_token_opt          = Token(2);
  1581.     p -> this_token             = Token(3);
  1582.     p -> left_parenthesis_token = Token(4);
  1583.     if (Sym(5) != NULL)
  1584.     {
  1585.         AstListNode *tail = (AstListNode *) Sym(5);
  1586.         p -> AllocateArguments(tail -> index + 1);
  1587.         AstListNode *root = tail;
  1588.         do
  1589.         {
  1590.             root = root -> next;
  1591.             p -> AddArgument((AstExpression *) root -> element);
  1592.         } while(root != tail);
  1593.         FreeCircularList(tail);
  1594.     }
  1595.     p -> right_parenthesis_token = Token(6);
  1596.     p -> semicolon_token         = Token(7);
  1597.     Sym(1) = p;
  1598. }
  1599.  
  1600. //
  1601. // Rule 109:  ExplicitConstructorInvocation ::= Primary DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1602. //
  1603. #line 2076 "java.g"
  1604. void Parser::MakeQualifiedSuper(void)
  1605. {
  1606.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1607.     p -> base_opt                = (AstExpression *) Sym(1);
  1608.     p -> dot_token_opt           = Token(2);
  1609.     p -> super_token             = Token(3);
  1610.     p -> left_parenthesis_token  = Token(4);
  1611.     if (Sym(5) != NULL)
  1612.     {
  1613.         AstListNode *tail = (AstListNode *) Sym(5);
  1614.         p -> AllocateArguments(tail -> index + 1);
  1615.         AstListNode *root = tail;
  1616.         do
  1617.         {
  1618.             root = root -> next;
  1619.             p -> AddArgument((AstExpression *) root -> element);
  1620.         } while(root != tail);
  1621.         FreeCircularList(tail);
  1622.     }
  1623.     p -> right_parenthesis_token = Token(6);
  1624.     p -> semicolon_token         = Token(7);
  1625.     Sym(1) = p;
  1626. }
  1627.  
  1628. //
  1629. // Rule 110:  ExplicitConstructorInvocation ::= Name DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1630. //
  1631. // void MakeQualifiedSuper(void);
  1632. //
  1633.  
  1634. //
  1635. // Rule 111:  InterfaceDeclaration ::= Modifiersopt interface Identifier ExtendsInterfacesopt InterfaceBody
  1636. //
  1637. #line 2119 "java.g"
  1638. void Parser::Act111(void)
  1639. {
  1640.     AstInterfaceDeclaration *p = (AstInterfaceDeclaration *) Sym(5);
  1641.     if (Sym(1) != NULL)
  1642.     {
  1643.         AstListNode *tail = (AstListNode *) Sym(1);
  1644.         p -> AllocateInterfaceModifiers(tail -> index + 1);
  1645.         AstListNode *root = tail;
  1646.         do
  1647.         {
  1648.             root = root -> next;
  1649.             p -> AddInterfaceModifier((AstModifier *) root -> element);
  1650.         } while(root != tail);
  1651.         FreeCircularList(tail);
  1652.     }
  1653.     p -> interface_token  = Token(2);
  1654.     p -> identifier_token = Token(3);
  1655.     if (Sym(4) != NULL)
  1656.     {
  1657.         AstListNode *tail = (AstListNode *) Sym(4);
  1658.         p -> AllocateExtendsInterfaces(tail -> index + 1);
  1659.         AstListNode *root = tail;
  1660.         do
  1661.         {
  1662.             root = root -> next;
  1663.             p -> AddExtendsInterface((AstExpression *) root -> element);
  1664.         } while(root != tail);
  1665.         FreeCircularList(tail);
  1666.     }
  1667.     Sym(1) = p;
  1668. }
  1669.  
  1670. //
  1671. // Rule 112:  ExtendsInterfaces ::= extends InterfaceTypeList
  1672. //
  1673. // void SetSym1ToSym2(void);
  1674. //
  1675.  
  1676. //
  1677. // Rule 113:  InterfaceBody ::= LBRACE InterfaceMemberDeclarationsopt RBRACE
  1678. //
  1679. #line 2162 "java.g"
  1680. void Parser::Act113(void)
  1681. {
  1682.     AstInterfaceDeclaration *p = ast_pool -> NewInterfaceDeclaration();
  1683.     if (parse_header_only)
  1684.         p -> mark_unparsed();
  1685.  
  1686.     p -> left_brace_token = Token(1);
  1687.     if (Sym(2) != NULL)
  1688.     {
  1689.         int num_class_variables = 0,
  1690.             num_methods = 0,
  1691.             num_inner_classes = 0,
  1692.             num_inner_interfaces = 0,
  1693.             num_empty_declarations = 0;
  1694.  
  1695.         AstListNode *tail = (AstListNode *) Sym(2);
  1696.         p -> AllocateInterfaceMemberDeclarations(tail -> index + 1);
  1697.         AstListNode *root = tail;
  1698.         do
  1699.         {
  1700.             root = root -> next;
  1701.             p -> AddInterfaceMemberDeclaration(root -> element);
  1702.  
  1703.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  1704.             if (field_declaration)
  1705.             {
  1706.                 field_declaration -> MarkStatic();
  1707.                 num_class_variables++;
  1708.             }
  1709.             else if (root -> element -> MethodDeclarationCast())
  1710.             {
  1711.                 num_methods++;
  1712.             }
  1713.             else if (root -> element -> ClassDeclarationCast())
  1714.             {
  1715.                 num_inner_classes++;
  1716.             }
  1717.             else if (root -> element -> InterfaceDeclarationCast())
  1718.             {
  1719.                 num_inner_interfaces++;
  1720.             }
  1721.             else num_empty_declarations++;
  1722.         } while(root != tail);
  1723.  
  1724.         p -> AllocateClassVariables(num_class_variables);
  1725.         p -> AllocateMethods(num_methods);
  1726.         p -> AllocateNestedClasses(num_inner_classes);
  1727.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  1728.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  1729.  
  1730.         root = tail;
  1731.         do
  1732.         {
  1733.             root = root -> next;
  1734.  
  1735.             AstFieldDeclaration *field_declaration;
  1736.             AstMethodDeclaration *method_declaration;
  1737.             AstClassDeclaration *class_declaration;
  1738.             AstInterfaceDeclaration *interface_declaration;
  1739.  
  1740.             if (field_declaration = root -> element -> FieldDeclarationCast())
  1741.             {
  1742.                 p -> AddClassVariable(field_declaration);
  1743.             }
  1744.             else if (method_declaration = root -> element -> MethodDeclarationCast())
  1745.             {
  1746.                 p -> AddMethod(method_declaration);
  1747.             }
  1748.             else if (class_declaration = root -> element -> ClassDeclarationCast())
  1749.             {
  1750.                 p -> AddNestedClass(class_declaration);
  1751.             }
  1752.             else if (interface_declaration = root -> element -> InterfaceDeclarationCast())
  1753.             {
  1754.                 p -> AddNestedInterface(interface_declaration);
  1755.             }
  1756.             else // assert(interface_declaration = root -> element -> EmptyDeclarationCast())
  1757.             {
  1758.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  1759.             }
  1760.         } while(root != tail);
  1761.         FreeCircularList(tail);
  1762.     }
  1763.     p -> right_brace_token = Token(3);
  1764.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  1765.     Sym(1) = p;
  1766. }
  1767.  
  1768. //
  1769. // Rule 114:  InterfaceMemberDeclarations ::= InterfaceMemberDeclaration
  1770. //
  1771. #line 2254 "java.g"
  1772. //
  1773. // Note that the list is circular so as to preserve the order of the elements
  1774. //
  1775. void Parser::Act114(void)
  1776. {
  1777.     AstListNode *p = AllocateListNode();
  1778.     p -> next = p;
  1779.     p -> element = Sym(1);
  1780.     p -> index = 0;
  1781.  
  1782.     Sym(1) = p;
  1783. }
  1784.  
  1785. //
  1786. // Rule 115:  InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
  1787. //
  1788. #line 2271 "java.g"
  1789. //
  1790. // Note that the list is circular so as to preserve the order of the elements
  1791. //
  1792. void Parser::Act115(void)
  1793. {
  1794.     AstListNode *tail = (AstListNode *) Sym(1);
  1795.  
  1796.     AstListNode *p = AllocateListNode();
  1797.     p -> element = Sym(2);
  1798.     p -> index = tail -> index + 1;
  1799.  
  1800.     p -> next = tail -> next;
  1801.     tail -> next = p;
  1802.  
  1803.     Sym(1) = p;
  1804. }
  1805.  
  1806. //
  1807. // Rule 116:  InterfaceMemberDeclaration -> ConstantDeclaration
  1808. //
  1809. // void NoAction(void);
  1810. //
  1811.  
  1812. //
  1813. // Rule 117:  InterfaceMemberDeclaration -> AbstractMethodDeclaration
  1814. //
  1815. // void NoAction(void);
  1816. //
  1817.  
  1818. //
  1819. // Rule 118:  InterfaceMemberDeclaration -> ClassDeclaration
  1820. //
  1821. // void NoAction(void);
  1822. //
  1823.  
  1824. //
  1825. // Rule 119:  InterfaceMemberDeclaration -> InterfaceDeclaration
  1826. //
  1827. // void NoAction(void);
  1828. //
  1829.  
  1830. //
  1831. // Rule 120:  InterfaceMemberDeclaration ::= SEMICOLON
  1832. //
  1833. #line 2317 "java.g"
  1834. void Parser::Act120(void)
  1835. {
  1836.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  1837. }
  1838.  
  1839. //
  1840. // Rule 121:  ConstantDeclaration -> FieldDeclaration
  1841. //
  1842. // void NoAction(void);
  1843. //
  1844.  
  1845. //
  1846. // Rule 122:  AbstractMethodDeclaration ::= MethodHeader SEMICOLON
  1847. //
  1848. #line 2330 "java.g"
  1849. void Parser::Act122(void)
  1850. {
  1851.     ((AstMethodDeclaration *) Sym(1)) -> method_body = ast_pool -> NewEmptyStatement(Token(2));
  1852. }
  1853.  
  1854. //
  1855. // Rule 123:  ArrayInitializer ::= LBRACE ,opt RBRACE
  1856. //
  1857. #line 2347 "java.g"
  1858. void Parser::Act123(void)
  1859. {
  1860.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1861.     p -> left_brace_token      = Token(1);
  1862.     p -> right_brace_token     = Token(3);
  1863.     Sym(1) = p;
  1864. }
  1865.  
  1866. //
  1867. // Rule 124:  ArrayInitializer ::= LBRACE VariableInitializers RBRACE
  1868. //
  1869. #line 2359 "java.g"
  1870. void Parser::Act124(void)
  1871. {
  1872.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1873.     p -> left_brace_token      = Token(1);
  1874.     if (Sym(2) != NULL)
  1875.     {
  1876.         AstListNode *tail = (AstListNode *) Sym(2);
  1877.         p -> AllocateVariableInitializers(tail -> index + 1);
  1878.         AstListNode *root = tail;
  1879.         do
  1880.         {
  1881.             root = root -> next;
  1882.             p -> AddVariableInitializer(root -> element);
  1883.         } while(root != tail);
  1884.         FreeCircularList(tail);
  1885.     }
  1886.     p -> right_brace_token     = Token(3);
  1887.     Sym(1) = p;
  1888. }
  1889.  
  1890. //
  1891. // Rule 125:  ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE
  1892. //
  1893. #line 2383 "java.g"
  1894. void Parser::Act125(void)
  1895. {
  1896.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1897.     p -> left_brace_token      = Token(1);
  1898.     if (Sym(2) != NULL)
  1899.     {
  1900.         AstListNode *tail = (AstListNode *) Sym(2);
  1901.         p -> AllocateVariableInitializers(tail -> index + 1);
  1902.         AstListNode *root = tail;
  1903.         do
  1904.         {
  1905.             root = root -> next;
  1906.             p -> AddVariableInitializer(root -> element);
  1907.         } while(root != tail);
  1908.         FreeCircularList(tail);
  1909.     }
  1910.     p -> right_brace_token     = Token(4);
  1911.     Sym(1) = p;
  1912. }
  1913.  
  1914. //
  1915. // Rule 126:  VariableInitializers ::= VariableInitializer
  1916. //
  1917. #line 2407 "java.g"
  1918. //
  1919. // Note that the list is circular so as to preserve the order of the elements
  1920. //
  1921. void Parser::Act126(void)
  1922. {
  1923.     AstListNode *p = AllocateListNode();
  1924.     p -> next = p;
  1925.     p -> element = Sym(1);
  1926.     p -> index = 0;
  1927.  
  1928.     Sym(1) = p;
  1929. }
  1930.  
  1931. //
  1932. // Rule 127:  VariableInitializers ::= VariableInitializers COMMA VariableInitializer
  1933. //
  1934. #line 2424 "java.g"
  1935. //
  1936. // Note that the list is circular so as to preserve the order of the elements
  1937. //
  1938. void Parser::Act127(void)
  1939. {
  1940.     AstListNode *tail = (AstListNode *) Sym(1);
  1941.  
  1942.     AstListNode *p = AllocateListNode();
  1943.     p -> element = Sym(3);
  1944.     p -> index = tail -> index + 1;
  1945.  
  1946.     p -> next = tail -> next;
  1947.     tail -> next = p;
  1948.  
  1949.     Sym(1) = p;
  1950. }
  1951.  
  1952. //
  1953. // Rule 128:  Block ::= LBRACE BlockStatementsopt RBRACE
  1954. //
  1955. #line 2447 "java.g"
  1956. void Parser::Act128(void)
  1957. {
  1958.     AstBlock *p = ast_pool -> NewBlock();
  1959.     p -> left_brace_token  = Token(1);
  1960.     if (Sym(2) != NULL)
  1961.     {
  1962.         AstListNode *tail = (AstListNode *) Sym(2);
  1963.         p -> AllocateBlockStatements(tail -> index + 1);
  1964.         AstListNode *root = tail;
  1965.         do
  1966.         {
  1967.             root = root -> next;
  1968.             p -> AddStatement((AstStatement *) root -> element);
  1969.         } while(root != tail);
  1970.         FreeCircularList(tail);
  1971.     }
  1972.     p -> right_brace_token = Token(3);
  1973.     Sym(1) = p;
  1974. }
  1975.  
  1976. //
  1977. // Rule 129:  BlockStatements ::= BlockStatement
  1978. //
  1979. #line 2471 "java.g"
  1980. //
  1981. // Note that the list is circular so as to preserve the order of the elements
  1982. //
  1983. void Parser::Act129(void)
  1984. {
  1985.     AstListNode *p = AllocateListNode();
  1986.     p -> next = p;
  1987.     p -> element = Sym(1);
  1988.     p -> index = 0;
  1989.  
  1990.     Sym(1) = p;
  1991. }
  1992.  
  1993. //
  1994. // Rule 130:  BlockStatements ::= BlockStatements BlockStatement
  1995. //
  1996. #line 2488 "java.g"
  1997. //
  1998. // Note that the list is circular so as to preserve the order of the elements
  1999. //
  2000. void Parser::Act130(void)
  2001. {
  2002.     AstListNode *tail = (AstListNode *) Sym(1);
  2003.  
  2004.     AstListNode *p = AllocateListNode();
  2005.     p -> element = Sym(2);
  2006.     p -> index = tail -> index + 1;
  2007.  
  2008.     p -> next = tail -> next;
  2009.     tail -> next = p;
  2010.  
  2011.     Sym(1) = p;
  2012. }
  2013.  
  2014. //
  2015. // Rule 131:  BlockStatement -> LocalVariableDeclarationStatement
  2016. //
  2017. // void NoAction(void);
  2018. //
  2019.  
  2020. //
  2021. // Rule 132:  BlockStatement -> Statement
  2022. //
  2023. // void NoAction(void);
  2024. //
  2025.  
  2026. //
  2027. // Rule 133:  BlockStatement -> ClassDeclaration
  2028. //
  2029. // void NoAction(void);
  2030. //
  2031.  
  2032. //
  2033. // Rule 134:  LocalVariableDeclarationStatement ::= LocalVariableDeclaration SEMICOLON
  2034. //
  2035. #line 2522 "java.g"
  2036. void Parser::Act134(void)
  2037. {
  2038.     ((AstLocalVariableDeclarationStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2039. }
  2040.  
  2041. //
  2042. // Rule 135:  LocalVariableDeclaration ::= Type VariableDeclarators
  2043. //
  2044. #line 2531 "java.g"
  2045. void Parser::Act135(void)
  2046. {
  2047.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2048.     p -> type                 = Sym(1);
  2049.     //
  2050.     // The list of declarators is guaranteed not empty
  2051.     //
  2052.     {
  2053.         AstListNode *tail = (AstListNode *) Sym(2);
  2054.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2055.         AstListNode *root = tail;
  2056.         do
  2057.         {
  2058.             root = root -> next;
  2059.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2060.         } while(root != tail);
  2061.         FreeCircularList(tail);
  2062.     }
  2063.     p -> semicolon_token_opt  = 0;
  2064.     Sym(1) = p;
  2065. }
  2066.  
  2067. //
  2068. // Rule 136:  LocalVariableDeclaration ::= Modifiers Type VariableDeclarators
  2069. //
  2070. #line 2558 "java.g"
  2071. void Parser::Act136(void)
  2072. {
  2073.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2074.     //
  2075.     // The list of modifiers is guaranteed not empty
  2076.     //
  2077.     {
  2078.         AstListNode *tail = (AstListNode *) Sym(1);
  2079.         p -> AllocateLocalModifiers(tail -> index + 1);
  2080.         AstListNode *root = tail;
  2081.         do
  2082.         {
  2083.             root = root -> next;
  2084.             p -> AddLocalModifier((AstModifier *) root -> element);
  2085.         } while(root != tail);
  2086.         FreeCircularList(tail);
  2087.     }
  2088.     p -> type = Sym(2);
  2089.     //
  2090.     // The list of declarators is guaranteed not empty
  2091.     //
  2092.     {
  2093.         AstListNode *tail = (AstListNode *) Sym(3);
  2094.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2095.         AstListNode *root = tail;
  2096.         do
  2097.         {
  2098.             root = root -> next;
  2099.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2100.         } while(root != tail);
  2101.         FreeCircularList(tail);
  2102.     }
  2103.     p -> semicolon_token_opt  = 0;
  2104.     Sym(1) = p;
  2105. }
  2106.  
  2107. //
  2108. // Rule 137:  Statement -> StatementWithoutTrailingSubstatement
  2109. //
  2110. // void NoAction(void);
  2111. //
  2112.  
  2113. //
  2114. // Rule 138:  Statement -> LabeledStatement
  2115. //
  2116. // void NoAction(void);
  2117. //
  2118.  
  2119. //
  2120. // Rule 139:  Statement -> IfThenStatement
  2121. //
  2122. // void NoAction(void);
  2123. //
  2124.  
  2125. //
  2126. // Rule 140:  Statement -> IfThenElseStatement
  2127. //
  2128. // void NoAction(void);
  2129. //
  2130.  
  2131. //
  2132. // Rule 141:  Statement -> WhileStatement
  2133. //
  2134. // void NoAction(void);
  2135. //
  2136.  
  2137. //
  2138. // Rule 142:  Statement -> ForStatement
  2139. //
  2140. // void NoAction(void);
  2141. //
  2142.  
  2143. //
  2144. // Rule 143:  StatementNoShortIf -> StatementWithoutTrailingSubstatement
  2145. //
  2146. // void NoAction(void);
  2147. //
  2148.  
  2149. //
  2150. // Rule 144:  StatementNoShortIf -> LabeledStatementNoShortIf
  2151. //
  2152. // void NoAction(void);
  2153. //
  2154.  
  2155. //
  2156. // Rule 145:  StatementNoShortIf -> IfThenElseStatementNoShortIf
  2157. //
  2158. // void NoAction(void);
  2159. //
  2160.  
  2161. //
  2162. // Rule 146:  StatementNoShortIf -> WhileStatementNoShortIf
  2163. //
  2164. // void NoAction(void);
  2165. //
  2166.  
  2167. //
  2168. // Rule 147:  StatementNoShortIf -> ForStatementNoShortIf
  2169. //
  2170. // void NoAction(void);
  2171. //
  2172.  
  2173. //
  2174. // Rule 148:  StatementWithoutTrailingSubstatement -> Block
  2175. //
  2176. // void NoAction(void);
  2177. //
  2178.  
  2179. //
  2180. // Rule 149:  StatementWithoutTrailingSubstatement -> EmptyStatement
  2181. //
  2182. // void NoAction(void);
  2183. //
  2184.  
  2185. //
  2186. // Rule 150:  StatementWithoutTrailingSubstatement -> ExpressionStatement
  2187. //
  2188. // void NoAction(void);
  2189. //
  2190.  
  2191. //
  2192. // Rule 151:  StatementWithoutTrailingSubstatement -> SwitchStatement
  2193. //
  2194. // void NoAction(void);
  2195. //
  2196.  
  2197. //
  2198. // Rule 152:  StatementWithoutTrailingSubstatement -> DoStatement
  2199. //
  2200. // void NoAction(void);
  2201. //
  2202.  
  2203. //
  2204. // Rule 153:  StatementWithoutTrailingSubstatement -> BreakStatement
  2205. //
  2206. // void NoAction(void);
  2207. //
  2208.  
  2209. //
  2210. // Rule 154:  StatementWithoutTrailingSubstatement -> ContinueStatement
  2211. //
  2212. // void NoAction(void);
  2213. //
  2214.  
  2215. //
  2216. // Rule 155:  StatementWithoutTrailingSubstatement -> ReturnStatement
  2217. //
  2218. // void NoAction(void);
  2219. //
  2220.  
  2221. //
  2222. // Rule 156:  StatementWithoutTrailingSubstatement -> SynchronizedStatement
  2223. //
  2224. // void NoAction(void);
  2225. //
  2226.  
  2227. //
  2228. // Rule 157:  StatementWithoutTrailingSubstatement -> ThrowStatement
  2229. //
  2230. // void NoAction(void);
  2231. //
  2232.  
  2233. //
  2234. // Rule 158:  StatementWithoutTrailingSubstatement -> TryStatement
  2235. //
  2236. // void NoAction(void);
  2237. //
  2238.  
  2239. //
  2240. // Rule 159:  EmptyStatement ::= SEMICOLON
  2241. //
  2242. // void MakeEmptyStatement(void);
  2243. //
  2244.  
  2245. //
  2246. // Rule 160:  LabeledStatement ::= Identifier COLON Statement
  2247. //
  2248. #line 2693 "java.g"
  2249. void Parser::MakeLabeledStatement(void)
  2250. {
  2251.     AstBlock *p = Sym(3) -> BlockCast();
  2252.  
  2253.     if (! (p && p -> NumStatements() == 1 &&
  2254.            (p -> Statement(0) -> kind == Ast::FOR   ||
  2255.             p -> Statement(0) -> kind == Ast::WHILE ||
  2256.             p -> Statement(0) -> kind == Ast::DO)))
  2257.     {
  2258.         //
  2259.         // When a statement is labeled, it is enclosed in a block.
  2260.         // This is necessary in order to allow the same name to be
  2261.         // reused to label a subsequent statement at the same nesting
  2262.         // level... See ProcessBlock, ProcessStatement,...
  2263.         //
  2264.         p = ast_pool -> NewBlock();
  2265.         p -> AllocateBlockStatements(1); // allocate 1 element
  2266.         p -> left_brace_token  = Token(1);
  2267.         p -> AddStatement((AstStatement *) Sym(3));
  2268.         p -> right_brace_token = Sym(3) -> RightToken();
  2269.     }
  2270.  
  2271.     p -> AddLabel(Token(1)); // add label to statement
  2272.     Sym(1) = p; // The final result is a block containing the labeled-statement
  2273. }
  2274.  
  2275. //
  2276. // Rule 161:  LabeledStatementNoShortIf ::= Identifier COLON StatementNoShortIf
  2277. //
  2278. // void MakeLabeledStatement(void);
  2279. //
  2280.  
  2281. //
  2282. // Rule 162:  ExpressionStatement ::= StatementExpression SEMICOLON
  2283. //
  2284. #line 2730 "java.g"
  2285. void Parser::Act162(void)
  2286. {
  2287.     ((AstExpressionStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2288. }
  2289.  
  2290. //
  2291. // Rule 163:  StatementExpression ::= Assignment
  2292. //
  2293. #line 2739 "java.g"
  2294. void Parser::MakeExpressionStatement(void)
  2295. {
  2296.     AstExpressionStatement *p = ast_pool -> NewExpressionStatement();
  2297.     p -> expression          = (AstExpression *) Sym(1);
  2298.     p -> semicolon_token_opt = 0;
  2299.     Sym(1) = p;
  2300. }
  2301.  
  2302. //
  2303. // Rule 164:  StatementExpression ::= PreIncrementExpression
  2304. //
  2305. // void MakeExpressionStatement(void);
  2306. //
  2307.  
  2308. //
  2309. // Rule 165:  StatementExpression ::= PreDecrementExpression
  2310. //
  2311. // void MakeExpressionStatement(void);
  2312. //
  2313.  
  2314. //
  2315. // Rule 166:  StatementExpression ::= PostIncrementExpression
  2316. //
  2317. // void MakeExpressionStatement(void);
  2318. //
  2319.  
  2320. //
  2321. // Rule 167:  StatementExpression ::= PostDecrementExpression
  2322. //
  2323. // void MakeExpressionStatement(void);
  2324. //
  2325.  
  2326. //
  2327. // Rule 168:  StatementExpression ::= MethodInvocation
  2328. //
  2329. // void MakeExpressionStatement(void);
  2330. //
  2331.  
  2332. //
  2333. // Rule 169:  StatementExpression ::= ClassInstanceCreationExpression
  2334. //
  2335. // void MakeExpressionStatement(void);
  2336. //
  2337.  
  2338. //
  2339. // Rule 170:  IfThenStatement ::= if LPAREN Expression RPAREN Statement
  2340. //
  2341. #line 2793 "java.g"
  2342. void Parser::Act170(void)
  2343. {
  2344.     AstBlock *block = Sym(5) -> BlockCast();
  2345.     if (! block)
  2346.     {
  2347.         block = ast_pool -> NewBlock();
  2348.         block -> AllocateBlockStatements(1); // allocate 1 element
  2349.         block -> left_brace_token  = Token(5);
  2350.         block -> AddStatement((AstStatement *) Sym(5));
  2351.         block -> right_brace_token = Sym(5) -> RightToken();
  2352.     }
  2353.  
  2354.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2355.     p -> if_token            = Token(1);
  2356.     p -> expression          = (AstExpression *) Sym(3);
  2357.     p -> true_statement      = block;
  2358.     p -> false_statement_opt = NULL;
  2359.     Sym(1) = p;
  2360. }
  2361.  
  2362. //
  2363. // Rule 171:  IfThenElseStatement ::= if LPAREN Expression RPAREN StatementNoShortIf else Statement
  2364. //
  2365. #line 2817 "java.g"
  2366. void Parser::MakeIfThenElseStatement(void)
  2367. {
  2368.     AstBlock *true_block = Sym(5) -> BlockCast();
  2369.     if (! true_block)
  2370.     {
  2371.         true_block = ast_pool -> NewBlock();
  2372.         true_block -> AllocateBlockStatements(1); // allocate 1 element
  2373.         true_block -> left_brace_token  = Token(5);
  2374.         true_block -> AddStatement((AstStatement *) Sym(5));
  2375.         true_block -> right_brace_token = Sym(5) -> RightToken();
  2376.     }
  2377.  
  2378.     AstBlock *false_block = Sym(7) -> BlockCast();
  2379.     if (! false_block)
  2380.     {
  2381.         false_block = ast_pool -> NewBlock();
  2382.         false_block -> AllocateBlockStatements(1); // allocate 1 element
  2383.         false_block -> left_brace_token  = Token(7);
  2384.         false_block -> AddStatement((AstStatement *) Sym(7));
  2385.         false_block -> right_brace_token = Sym(7) -> RightToken();
  2386.     }
  2387.  
  2388.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2389.     p -> if_token            = Token(1);
  2390.     p -> expression          = (AstExpression *) Sym(3);
  2391.     p -> true_statement      = true_block;
  2392.     p -> false_statement_opt = false_block;
  2393.     Sym(1) = p;
  2394. }
  2395.  
  2396. //
  2397. // Rule 172:  IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN StatementNoShortIf else StatementNoShortIf
  2398. //
  2399. // void MakeIfThenElseStatement(void);
  2400. //
  2401.  
  2402. //
  2403. // Rule 173:  SwitchStatement ::= switch LPAREN Expression RPAREN SwitchBlock
  2404. //
  2405. #line 2858 "java.g"
  2406. void Parser::Act173(void)
  2407. {
  2408.     AstSwitchStatement *p = (AstSwitchStatement *) Sym(5);
  2409.     p -> switch_token = Token(1);
  2410.     p -> expression   = (AstExpression *) Sym(3);
  2411.     Sym(1) = p;
  2412. }
  2413.  
  2414. //
  2415. // Rule 174:  SwitchBlock ::= LBRACE RBRACE
  2416. //
  2417. #line 2870 "java.g"
  2418. void Parser::Act174(void)
  2419. {
  2420.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2421.  
  2422.     AstBlock *block = ast_pool -> NewBlock();
  2423.     block -> left_brace_token  = Token(1);
  2424.     block -> right_brace_token = Token(2);
  2425.  
  2426.     p -> switch_block = block;
  2427.  
  2428.     Sym(1) = p;
  2429. }
  2430.  
  2431. //
  2432. // Rule 175:  SwitchBlock ::= LBRACE SwitchBlockStatements RBRACE
  2433. //
  2434. #line 2887 "java.g"
  2435. void Parser::Act175(void)
  2436. {
  2437.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2438.  
  2439.     AstBlock *block = ast_pool -> NewBlock();
  2440.     block -> left_brace_token  = Token(1);
  2441.     if (Sym(2) != NULL)
  2442.     {
  2443.         AstListNode *tail = (AstListNode *) Sym(2);
  2444.         block -> AllocateBlockStatements(tail -> index + 1);
  2445.         AstListNode *root = tail;
  2446.         do
  2447.         {
  2448.             root = root -> next;
  2449.             block -> AddStatement((AstStatement *) root -> element);
  2450.         } while(root != tail);
  2451.         FreeCircularList(tail);
  2452.     }
  2453.     block -> right_brace_token = Token(3);
  2454.  
  2455.     p -> switch_block  = block;
  2456.  
  2457.     Sym(1) = p;
  2458. }
  2459.  
  2460. //
  2461. // Rule 176:  SwitchBlock ::= LBRACE SwitchLabels RBRACE
  2462. //
  2463. #line 2916 "java.g"
  2464. void Parser::Act176(void)
  2465. {
  2466.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2467.  
  2468.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2469.     q -> AddStatement(ast_pool -> NewEmptyStatement(Token(Sym(2) -> RightToken())));
  2470.  
  2471.     //
  2472.     // The list of SwitchBlockStatements is never null
  2473.     //
  2474.     {
  2475.         AstListNode *tail = (AstListNode *) Sym(2);
  2476.         q -> AllocateSwitchLabels(tail -> index + 1);
  2477.         AstListNode *root = tail;
  2478.         do
  2479.         {
  2480.             root = root -> next;
  2481.             q -> AddSwitchLabel((AstStatement *) root -> element);
  2482.         } while(root != tail);
  2483.         FreeCircularList(tail);
  2484.     }
  2485.  
  2486.     AstBlock *block = ast_pool -> NewBlock();
  2487.     block -> AllocateBlockStatements(1); // allocate 1 element
  2488.     block -> left_brace_token  = Token(1);
  2489.     block -> AddStatement(q);
  2490.     block -> right_brace_token = Token(3);
  2491.  
  2492.     p -> switch_block  = block;
  2493.  
  2494.     Sym(1) = p;
  2495. }
  2496.  
  2497. //
  2498. // Rule 177:  SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE
  2499. //
  2500. #line 2953 "java.g"
  2501. void Parser::Act177(void)
  2502. {
  2503.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2504.  
  2505.     AstBlock *block = ast_pool -> NewBlock();
  2506.     block -> left_brace_token  = Token(1);
  2507.     //
  2508.     // The list of SwitchBlockStatements is never null
  2509.     //
  2510.     {
  2511.         AstListNode *tail = (AstListNode *) Sym(2);
  2512.         block -> AllocateBlockStatements(tail -> index + 2); // +1 because of extra statement for additional SwithLabels
  2513.         AstListNode *root = tail;
  2514.         do
  2515.         {
  2516.             root = root -> next;
  2517.             block -> AddStatement((AstStatement *) root -> element);
  2518.         } while(root != tail);
  2519.         FreeCircularList(tail);
  2520.     }
  2521.  
  2522.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2523.     q -> AddStatement(ast_pool -> NewEmptyStatement(Token(Sym(3) -> RightToken())));
  2524.  
  2525.     //
  2526.     // The list of SwitchLabels is never null
  2527.     //
  2528.     {
  2529.         AstListNode *tail = (AstListNode *) Sym(3);
  2530.         q -> AllocateSwitchLabels(tail -> index + 1);
  2531.         AstListNode *root = tail;
  2532.         do
  2533.         {
  2534.             root = root -> next;
  2535.             q -> AddSwitchLabel(root -> element);
  2536.         } while(root != tail);
  2537.         FreeCircularList(tail);
  2538.     }
  2539.  
  2540.     block -> AddStatement(q);
  2541.     block -> right_brace_token = Token(4);
  2542.  
  2543.     p -> switch_block  = block;
  2544.  
  2545.     Sym(1) = p;
  2546. }
  2547.  
  2548. //
  2549. // Rule 178:  SwitchBlockStatements ::= SwitchBlockStatement
  2550. //
  2551. #line 3004 "java.g"
  2552. //
  2553. // Note that the list is circular so as to preserve the order of the elements
  2554. //
  2555. void Parser::Act178(void)
  2556. {
  2557.     AstListNode *p = AllocateListNode();
  2558.     p -> next = p;
  2559.     p -> element = Sym(1);
  2560.     p -> index = 0;
  2561.  
  2562.     Sym(1) = p;
  2563. }
  2564.  
  2565. //
  2566. // Rule 179:  SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
  2567. //
  2568. #line 3021 "java.g"
  2569. //
  2570. // Note that the list is circular so as to preserve the order of the elements
  2571. //
  2572. void Parser::Act179(void)
  2573. {
  2574.     AstListNode *tail = (AstListNode *) Sym(1);
  2575.  
  2576.     AstListNode *p = AllocateListNode();
  2577.     p -> element = Sym(2);
  2578.     p -> index = tail -> index + 1;
  2579.  
  2580.     p -> next = tail -> next;
  2581.     tail -> next = p;
  2582.  
  2583.     Sym(1) = p;
  2584. }
  2585.  
  2586. //
  2587. // Rule 180:  SwitchBlockStatement ::= SwitchLabels BlockStatements
  2588. //
  2589. #line 3042 "java.g"
  2590. void Parser::Act180(void)
  2591. {
  2592.     AstSwitchBlockStatement *p = ast_pool -> NewSwitchBlockStatement();
  2593.     //
  2594.     // The list of SwitchLabels is never null
  2595.     //
  2596.     {
  2597.         AstListNode *tail = (AstListNode *) Sym(1);
  2598.         p -> AllocateSwitchLabels(tail -> index + 1);
  2599.         AstListNode *root = tail;
  2600.         do
  2601.         {
  2602.             root = root -> next;
  2603.             p -> AddSwitchLabel(root -> element);
  2604.         } while(root != tail);
  2605.         FreeCircularList(tail);
  2606.     }
  2607.  
  2608.     //
  2609.     // The list of SwitchBlockStatements is never null
  2610.     //
  2611.     {
  2612.         AstListNode *tail = (AstListNode *) Sym(2);
  2613.         p -> AllocateBlockStatements(tail -> index + 1);
  2614.         AstListNode *root = tail;
  2615.         do
  2616.         {
  2617.             root = root -> next;
  2618.             p -> AddStatement((AstStatement *) root -> element);
  2619.         } while(root != tail);
  2620.         FreeCircularList(tail);
  2621.     }
  2622.     Sym(1) = p;
  2623. }
  2624.  
  2625. //
  2626. // Rule 181:  SwitchLabels ::= SwitchLabel
  2627. //
  2628. #line 3081 "java.g"
  2629. //
  2630. // Note that the list is circular so as to preserve the order of the elements
  2631. //
  2632. void Parser::Act181(void)
  2633. {
  2634.     AstListNode *p = AllocateListNode();
  2635.     p -> next = p;
  2636.     p -> element = Sym(1);
  2637.     p -> index = 0;
  2638.  
  2639.     Sym(1) = p;
  2640. }
  2641.  
  2642. //
  2643. // Rule 182:  SwitchLabels ::= SwitchLabels SwitchLabel
  2644. //
  2645. #line 3098 "java.g"
  2646. //
  2647. // Note that the list is circular so as to preserve the order of the elements
  2648. //
  2649. void Parser::Act182(void)
  2650. {
  2651.     AstListNode *tail = (AstListNode *) Sym(1);
  2652.  
  2653.     AstListNode *p = AllocateListNode();
  2654.     p -> element = Sym(2);
  2655.     p -> index = tail -> index + 1;
  2656.  
  2657.     p -> next = tail -> next;
  2658.     tail -> next = p;
  2659.  
  2660.     Sym(1) = p;
  2661. }
  2662.  
  2663. //
  2664. // Rule 183:  SwitchLabel ::= case ConstantExpression COLON
  2665. //
  2666. #line 3119 "java.g"
  2667. void Parser::Act183(void)
  2668. {
  2669.     AstCaseLabel *p = ast_pool -> NewCaseLabel();
  2670.     p -> case_token  = Token(1);
  2671.     p -> expression  = (AstExpression *) Sym(2);
  2672.     p -> colon_token = Token(3);
  2673.     Sym(1) = p;
  2674. }
  2675.  
  2676. //
  2677. // Rule 184:  SwitchLabel ::= default COLON
  2678. //
  2679. #line 3132 "java.g"
  2680. void Parser::Act184(void)
  2681. {
  2682.     AstDefaultLabel *p = ast_pool -> NewDefaultLabel();
  2683.     p -> default_token = Token(1);
  2684.     p -> colon_token   = Token(2);
  2685.     Sym(1) = p;
  2686. }
  2687.  
  2688. //
  2689. // Rule 185:  WhileStatement ::= while LPAREN Expression RPAREN Statement
  2690. //
  2691. #line 3144 "java.g"
  2692. void Parser::MakeWhileStatement(void)
  2693. {
  2694.     AstWhileStatement *p = ast_pool -> NewWhileStatement();
  2695.     p -> while_token = Token(1);
  2696.     p -> expression  = (AstExpression *) Sym(3);
  2697.     p -> statement   = (AstStatement *) Sym(5);
  2698.  
  2699.     AstBlock *block = ast_pool -> NewBlock();
  2700.     block -> AllocateBlockStatements(1); // allocate 1 element
  2701.     block -> left_brace_token  = Token(1); // point to 'FOR' keyword
  2702.     block -> AddStatement(p);
  2703.     block -> right_brace_token = Sym(5) -> RightToken(); // point to last token in statement
  2704.  
  2705.     Sym(1) = block;
  2706. }
  2707.  
  2708. //
  2709. // Rule 186:  WhileStatementNoShortIf ::= while LPAREN Expression RPAREN StatementNoShortIf
  2710. //
  2711. // void MakeWhileStatement(void);
  2712. //
  2713.  
  2714. //
  2715. // Rule 187:  DoStatement ::= do Statement while LPAREN Expression RPAREN SEMICOLON
  2716. //
  2717. #line 3171 "java.g"
  2718. void Parser::Act187(void)
  2719. {
  2720.     AstDoStatement *p = ast_pool -> NewDoStatement();
  2721.     p -> do_token        = Token(1);
  2722.     p -> statement       = (AstStatement *) Sym(2);
  2723.     p -> while_token     = Token(3);
  2724.     p -> expression      = (AstExpression *) Sym(5);
  2725.     p -> semicolon_token = Token(7);
  2726.  
  2727.     AstBlock *block = ast_pool -> NewBlock();
  2728.     block -> AllocateBlockStatements(1); // allocate 1 element
  2729.     block -> left_brace_token  = Token(1);
  2730.     block -> AddStatement(p);
  2731.     block -> right_brace_token = Token(7);
  2732.  
  2733.     Sym(1) = block;
  2734. }
  2735.  
  2736. //
  2737. // Rule 188:  ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN Statement
  2738. //
  2739. #line 3193 "java.g"
  2740. void Parser::MakeForStatement(void)
  2741. {
  2742.     AstForStatement *p = ast_pool -> NewForStatement();
  2743.     p -> for_token = Token(1);
  2744.     if (Sym(3) != NULL)
  2745.     {
  2746.         AstListNode *tail = (AstListNode *) Sym(3);
  2747.         p -> AllocateForInitStatements(tail -> index + 1);
  2748.         AstListNode *root = tail;
  2749.         do
  2750.         {
  2751.             root = root -> next;
  2752.             p -> AddForInitStatement((AstStatement *) root -> element);
  2753.         } while(root != tail);
  2754.         FreeCircularList(tail);
  2755.     }
  2756.     p -> end_expression_opt = (AstExpression *) Sym(5);
  2757.     if (Sym(7) != NULL)
  2758.     {
  2759.         AstListNode *tail = (AstListNode *) Sym(7);
  2760.         p -> AllocateForUpdateStatements(tail -> index + 1);
  2761.         AstListNode *root = tail;
  2762.         do
  2763.         {
  2764.             root = root -> next;
  2765.             p -> AddForUpdateStatement((AstExpressionStatement *) root -> element);
  2766.         } while(root != tail);
  2767.         FreeCircularList(tail);
  2768.     }
  2769.     p -> statement = (AstStatement *) Sym(9);
  2770.  
  2771.     AstBlock *block = ast_pool -> NewBlock();
  2772.     block -> AllocateBlockStatements(1); // allocate 1 element
  2773.     block -> left_brace_token  = Token(1);
  2774.     block -> AddStatement(p);
  2775.     block -> right_brace_token = Sym(9) -> RightToken();
  2776.  
  2777.     Sym(1) = block;
  2778. }
  2779.  
  2780. //
  2781. // Rule 189:  ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN...
  2782. //
  2783. // void MakeForStatement(void);
  2784. //
  2785.  
  2786. //
  2787. // Rule 190:  ForInit -> StatementExpressionList
  2788. //
  2789. // void NoAction(void);
  2790. //
  2791.  
  2792. //
  2793. // Rule 191:  ForInit ::= LocalVariableDeclaration
  2794. //
  2795. #line 3248 "java.g"
  2796. //
  2797. // Note that the list is circular so as to preserve the order of the elements
  2798. //
  2799. void Parser::Act191(void)
  2800. {
  2801.     AstListNode *p = AllocateListNode();
  2802.     p -> next = p;
  2803.     p -> element = Sym(1);
  2804.     p -> index = 0;
  2805.  
  2806.     Sym(1) = p;
  2807. }
  2808.  
  2809. //
  2810. // Rule 192:  ForUpdate -> StatementExpressionList
  2811. //
  2812. // void NoAction(void);
  2813. //
  2814.  
  2815. //
  2816. // Rule 193:  StatementExpressionList ::= StatementExpression
  2817. //
  2818. #line 3269 "java.g"
  2819. //
  2820. // Note that the list is circular so as to preserve the order of the elements
  2821. //
  2822. void Parser::Act193(void)
  2823. {
  2824.     AstListNode *p = AllocateListNode();
  2825.     p -> next = p;
  2826.     p -> element = Sym(1);
  2827.     p -> index = 0;
  2828.  
  2829.     Sym(1) = p;
  2830. }
  2831.  
  2832. //
  2833. // Rule 194:  StatementExpressionList ::= StatementExpressionList COMMA StatementExpression
  2834. //
  2835. #line 3286 "java.g"
  2836. //
  2837. // Note that the list is circular so as to preserve the order of the elements
  2838. //
  2839. void Parser::Act194(void)
  2840. {
  2841.     AstListNode *tail = (AstListNode *) Sym(1);
  2842.  
  2843.     AstListNode *p = AllocateListNode();
  2844.     p -> element = Sym(3);
  2845.     p -> index = tail -> index + 1;
  2846.  
  2847.     p -> next = tail -> next;
  2848.     tail -> next = p;
  2849.  
  2850.     Sym(1) = p;
  2851. }
  2852.  
  2853. //
  2854. // Rule 195:  BreakStatement ::= break SEMICOLON
  2855. //
  2856. #line 3313 "java.g"
  2857. void Parser::Act195(void)
  2858. {
  2859.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2860.     p -> break_token          = Token(1);
  2861.     p -> identifier_token_opt = 0;
  2862.     p -> semicolon_token      = Token(2);
  2863.     Sym(1) = p;
  2864. }
  2865.  
  2866. //
  2867. // Rule 196:  BreakStatement ::= break Identifier SEMICOLON
  2868. //
  2869. #line 3326 "java.g"
  2870. void Parser::Act196(void)
  2871. {
  2872.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2873.     p -> break_token          = Token(1);
  2874.     p -> identifier_token_opt = Token(2);
  2875.     p -> semicolon_token      = Token(3);
  2876.     Sym(1) = p;
  2877. }
  2878.  
  2879. //
  2880. // Rule 197:  ContinueStatement ::= continue SEMICOLON
  2881. //
  2882. #line 3339 "java.g"
  2883. void Parser::Act197(void)
  2884. {
  2885.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2886.     p -> continue_token       = Token(1);
  2887.     p -> identifier_token_opt = 0;
  2888.     p -> semicolon_token      = Token(2);
  2889.     Sym(1) = p;
  2890. }
  2891.  
  2892. //
  2893. // Rule 198:  ContinueStatement ::= continue Identifier SEMICOLON
  2894. //
  2895. #line 3352 "java.g"
  2896. void Parser::Act198(void)
  2897. {
  2898.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2899.     p -> continue_token       = Token(1);
  2900.     p -> identifier_token_opt = Token(2);
  2901.     p -> semicolon_token      = Token(3);
  2902.     Sym(1) = p;
  2903. }
  2904.  
  2905. //
  2906. // Rule 199:  ReturnStatement ::= return Expressionopt SEMICOLON
  2907. //
  2908. #line 3365 "java.g"
  2909. void Parser::Act199(void)
  2910. {
  2911.     AstReturnStatement *p = ast_pool -> NewReturnStatement();
  2912.     p -> return_token    = Token(1);
  2913.     p -> expression_opt  = (AstExpression *) Sym(2);
  2914.     p -> semicolon_token = Token(3);
  2915.     Sym(1) = p;
  2916. }
  2917.  
  2918. //
  2919. // Rule 200:  ThrowStatement ::= throw Expression SEMICOLON
  2920. //
  2921. #line 3378 "java.g"
  2922. void Parser::Act200(void)
  2923. {
  2924.     AstThrowStatement *p = ast_pool -> NewThrowStatement();
  2925.     p -> throw_token     = Token(1);
  2926.     p -> expression      = (AstExpression *) Sym(2);
  2927.     p -> semicolon_token = Token(3);
  2928.     Sym(1) = p;
  2929. }
  2930.  
  2931. //
  2932. // Rule 201:  SynchronizedStatement ::= synchronized LPAREN Expression RPAREN Block
  2933. //
  2934. #line 3391 "java.g"
  2935. void Parser::Act201(void)
  2936. {
  2937.     AstSynchronizedStatement *p = ast_pool -> NewSynchronizedStatement();
  2938.     p -> synchronized_token = Token(1);
  2939.     p -> expression         = (AstExpression *) Sym(3);
  2940.     p -> block              = (AstBlock *) Sym(5);
  2941.     Sym(1) = p;
  2942. }
  2943.  
  2944. //
  2945. // Rule 202:  TryStatement ::= try Block Catches
  2946. //
  2947. #line 3404 "java.g"
  2948. void Parser::Act202(void)
  2949. {
  2950.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2951.     p -> try_token          = Token(1);
  2952.     p -> block              = (AstBlock *) Sym(2);
  2953.     //
  2954.     // The list of modifiers is guaranteed not empty
  2955.     //
  2956.     {
  2957.         AstListNode *tail = (AstListNode *) Sym(3);
  2958.         p -> AllocateCatchClauses(tail -> index + 1);
  2959.         AstListNode *root = tail;
  2960.         do
  2961.         {
  2962.             root = root -> next;
  2963.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2964.         } while(root != tail);
  2965.         FreeCircularList(tail);
  2966.     }
  2967.     p -> finally_clause_opt = NULL;
  2968.     Sym(1) = p;
  2969. }
  2970.  
  2971. //
  2972. // Rule 203:  TryStatement ::= try Block Catchesopt Finally
  2973. //
  2974. #line 3431 "java.g"
  2975. void Parser::Act203(void)
  2976. {
  2977.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2978.     p -> try_token      = Token(1);
  2979.     p -> block          = (AstBlock *) Sym(2);
  2980.     if (Sym(3) != NULL)
  2981.     {
  2982.         AstListNode *tail = (AstListNode *) Sym(3);
  2983.         p -> AllocateCatchClauses(tail -> index + 1);
  2984.         AstListNode *root = tail;
  2985.         do
  2986.         {
  2987.             root = root -> next;
  2988.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2989.         } while(root != tail);
  2990.         FreeCircularList(tail);
  2991.     }
  2992.     p -> finally_clause_opt = (AstFinallyClause *) Sym(4);
  2993.     Sym(1) = p;
  2994. }
  2995.  
  2996. //
  2997. // Rule 204:  Catches ::= CatchClause
  2998. //
  2999. #line 3456 "java.g"
  3000. //
  3001. // Note that the list is circular so as to preserve the order of the elements
  3002. //
  3003. void Parser::Act204(void)
  3004. {
  3005.     AstListNode *p = AllocateListNode();
  3006.     p -> next = p;
  3007.     p -> element = Sym(1);
  3008.     p -> index = 0;
  3009.  
  3010.     Sym(1) = p;
  3011. }
  3012.  
  3013. //
  3014. // Rule 205:  Catches ::= Catches CatchClause
  3015. //
  3016. #line 3473 "java.g"
  3017. //
  3018. // Note that the list is circular so as to preserve the order of the elements
  3019. //
  3020. void Parser::Act205(void)
  3021. {
  3022.     AstListNode *tail = (AstListNode *) Sym(1);
  3023.  
  3024.     AstListNode *p = AllocateListNode();
  3025.     p -> element = Sym(2);
  3026.     p -> index = tail -> index + 1;
  3027.  
  3028.     p -> next = tail -> next;
  3029.     tail -> next = p;
  3030.  
  3031.     Sym(1) = p;
  3032. }
  3033.  
  3034. //
  3035. // Rule 206:  CatchClause ::= catch LPAREN FormalParameter RPAREN Block
  3036. //
  3037. #line 3494 "java.g"
  3038. void Parser::Act206(void)
  3039. {
  3040.     AstCatchClause *p = ast_pool -> NewCatchClause();
  3041.     p -> catch_token      = Token(1);
  3042.     p -> formal_parameter = (AstFormalParameter *) Sym(3);
  3043.     p -> block            = (AstBlock *) Sym(5);
  3044.     Sym(1) = p;
  3045. }
  3046.  
  3047. //
  3048. // Rule 207:  Finally ::= finally Block
  3049. //
  3050. #line 3507 "java.g"
  3051. void Parser::Act207(void)
  3052. {
  3053.     AstFinallyClause *p = ast_pool -> NewFinallyClause();
  3054.     p -> finally_token = Token(1);
  3055.     p -> block         = (AstBlock *) Sym(2);
  3056.     Sym(1) = p;
  3057. }
  3058.  
  3059. //
  3060. // Rule 208:  Primary -> PrimaryNoNewArray
  3061. //
  3062. // void NoAction(void);
  3063. //
  3064.  
  3065. //
  3066. // Rule 209:  Primary -> ArrayCreationExpression
  3067. //
  3068. // void NoAction(void);
  3069. //
  3070.  
  3071. //
  3072. // Rule 210:  PrimaryNoNewArray -> Literal
  3073. //
  3074. // void NoAction(void);
  3075. //
  3076.  
  3077. //
  3078. // Rule 211:  PrimaryNoNewArray ::= this
  3079. //
  3080. #line 3533 "java.g"
  3081. void Parser::Act211(void)
  3082. {
  3083.     Sym(1) = ast_pool -> NewThisExpression(Token(1));
  3084. }
  3085.  
  3086. //
  3087. // Rule 212:  PrimaryNoNewArray ::= LPAREN Expression RPAREN
  3088. //
  3089. #line 3542 "java.g"
  3090. void Parser::Act212(void)
  3091. {
  3092.     AstParenthesizedExpression *p = ast_pool -> NewParenthesizedExpression();
  3093.     p -> left_parenthesis_token = Token(1);
  3094.     p -> expression = (AstExpression *) Sym(2);
  3095.     p -> right_parenthesis_token = Token(3);
  3096.     Sym(1) = p;
  3097. }
  3098.  
  3099. //
  3100. // Rule 213:  PrimaryNoNewArray -> ClassInstanceCreationExpression
  3101. //
  3102. // void NoAction(void);
  3103. //
  3104.  
  3105. //
  3106. // Rule 214:  PrimaryNoNewArray -> FieldAccess
  3107. //
  3108. // void NoAction(void);
  3109. //
  3110.  
  3111. //
  3112. // Rule 215:  PrimaryNoNewArray ::= Name DOT this
  3113. //
  3114. #line 3564 "java.g"
  3115. void Parser::Act215(void)
  3116. {
  3117.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::THIS_TAG);
  3118.     p -> base = (AstExpression *) Sym(1);
  3119.     p -> dot_token = Token(2);
  3120.     p -> identifier_token = Token(3);
  3121.     Sym(1) = p;
  3122. }
  3123.  
  3124. //
  3125. // Rule 216:  PrimaryNoNewArray ::= Type DOT class
  3126. //
  3127. #line 3578 "java.g"
  3128. void Parser::Act216(void)
  3129. {
  3130.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3131.     p -> base = ast_pool -> NewTypeExpression(Sym(1));
  3132.     p -> dot_token = Token(2);
  3133.     p -> identifier_token = Token(3);
  3134.     Sym(1) = p;
  3135. }
  3136.  
  3137. //
  3138. // Rule 217:  PrimaryNoNewArray ::= void DOT class
  3139. //
  3140. #line 3592 "java.g"
  3141. void Parser::Act217(void)
  3142. {
  3143.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3144.     p -> base = ast_pool -> NewTypeExpression(ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(1)));
  3145.     p -> dot_token = Token(2);
  3146.     p -> identifier_token = Token(3);
  3147.     Sym(1) = p;
  3148. }
  3149.  
  3150. //
  3151. // Rule 218:  PrimaryNoNewArray -> MethodInvocation
  3152. //
  3153. // void NoAction(void);
  3154. //
  3155.  
  3156. //
  3157. // Rule 219:  PrimaryNoNewArray -> ArrayAccess
  3158. //
  3159. // void NoAction(void);
  3160. //
  3161.  
  3162. //
  3163. // Rule 220:  ClassInstanceCreationExpression ::= new ClassType LPAREN ArgumentListopt RPAREN ClassBodyopt
  3164. //
  3165. #line 3618 "java.g"
  3166. void Parser::Act220(void)
  3167. {
  3168.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3169.     p -> base_opt                = NULL;
  3170.     p -> dot_token_opt           = 0;
  3171.     p -> new_token               = Token(1);
  3172.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(2));
  3173.     p -> left_parenthesis_token  = Token(3);
  3174.     if (Sym(4) != NULL)
  3175.     {
  3176.         AstListNode *tail = (AstListNode *) Sym(4);
  3177.         p -> AllocateArguments(tail -> index + 1);
  3178.         AstListNode *root = tail;
  3179.         do
  3180.         {
  3181.             root = root -> next;
  3182.             p -> AddArgument((AstExpression *) root -> element);
  3183.         } while(root != tail);
  3184.         FreeCircularList(tail);
  3185.     }
  3186.     p -> right_parenthesis_token = Token(5);
  3187.     p -> class_body_opt          = (AstClassBody *) Sym(6);
  3188.     Sym(1) = p;
  3189. }
  3190.  
  3191. //
  3192. // Rule 221:  ClassInstanceCreationExpression ::= Primary DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3193. //
  3194. #line 3648 "java.g"
  3195. void Parser::MakeQualifiedNew(void)
  3196. {
  3197.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3198.     p -> base_opt                = (AstExpression *) Sym(1);
  3199.     p -> dot_token_opt           = Token(2);
  3200.     p -> new_token               = Token(3);
  3201.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(4));
  3202.     p -> left_parenthesis_token  = Token(5);
  3203.     if (Sym(6) != NULL)
  3204.     {
  3205.         AstListNode *tail = (AstListNode *) Sym(6);
  3206.         p -> AllocateArguments(tail -> index + 1);
  3207.         AstListNode *root = tail;
  3208.         do
  3209.         {
  3210.             root = root -> next;
  3211.             p -> AddArgument((AstExpression *) root -> element);
  3212.         } while(root != tail);
  3213.         FreeCircularList(tail);
  3214.     }
  3215.     p -> right_parenthesis_token = Token(7);
  3216.     p -> class_body_opt          = (AstClassBody *) Sym(8);
  3217.     Sym(1) = p;
  3218. }
  3219.  
  3220. //
  3221. // Rule 222:  ClassInstanceCreationExpression ::= Name DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3222. //
  3223. // void MakeQualifiedNew(void);
  3224. //
  3225.  
  3226. //
  3227. // Rule 223:  ArgumentList ::= Expression
  3228. //
  3229. #line 3685 "java.g"
  3230. //
  3231. // Note that the list is circular so as to preserve the order of the elements
  3232. //
  3233. void Parser::Act223(void)
  3234. {
  3235.     AstListNode *p = AllocateListNode();
  3236.     p -> next = p;
  3237.     p -> element = Sym(1);
  3238.     p -> index = 0;
  3239.  
  3240.     Sym(1) = p;
  3241. }
  3242.  
  3243. //
  3244. // Rule 224:  ArgumentList ::= ArgumentList COMMA Expression
  3245. //
  3246. #line 3702 "java.g"
  3247. //
  3248. // Note that the list is circular so as to preserve the order of the elements
  3249. //
  3250. void Parser::Act224(void)
  3251. {
  3252.     AstListNode *tail = (AstListNode *) Sym(1);
  3253.  
  3254.     AstListNode *p = AllocateListNode();
  3255.     p -> element = Sym(3);
  3256.     p -> index = tail -> index + 1;
  3257.  
  3258.     p -> next = tail -> next;
  3259.     tail -> next = p;
  3260.  
  3261.     Sym(1) = p;
  3262. }
  3263.  
  3264. //
  3265. // Rule 225:  ArrayCreationExpression ::= new PrimitiveType DimExprs Dimsopt
  3266. //
  3267. #line 3723 "java.g"
  3268. void Parser::MakeArrayCreationExpression(void)
  3269. {
  3270.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3271.     p -> new_token             = Token(1);
  3272.     p -> array_type            = Sym(2);
  3273.     //
  3274.     // The list of DimExprs is never null
  3275.     //
  3276.     {
  3277.         AstListNode *tail = (AstListNode *) Sym(3);
  3278.         p -> AllocateDimExprs(tail -> index + 1);
  3279.         AstListNode *root = tail;
  3280.         do
  3281.         {
  3282.             root = root -> next;
  3283.             p -> AddDimExpr((AstDimExpr *) root -> element);
  3284.         } while(root != tail);
  3285.         FreeCircularList(tail);
  3286.     }
  3287.  
  3288.     if (Sym(4) != NULL)
  3289.     {
  3290.         AstListNode *tail = (AstListNode *) Sym(4);
  3291.         p -> AllocateBrackets(tail -> index + 1);
  3292.         AstListNode *root = tail;
  3293.         do
  3294.         {
  3295.             root = root -> next;
  3296.             p -> AddBrackets((AstBrackets *) root -> element);
  3297.         } while(root != tail);
  3298.         FreeCircularList(tail);
  3299.     }
  3300.     p -> array_initializer_opt = NULL;
  3301.     Sym(1) = p;
  3302. }
  3303.  
  3304. //
  3305. // Rule 226:  ArrayCreationExpression ::= new ClassOrInterfaceType DimExprs Dimsopt
  3306. //
  3307. // void MakeArrayCreationExpression(void);
  3308. //
  3309.  
  3310. //
  3311. // Rule 227:  ArrayCreationExpression ::= new ArrayType ArrayInitializer
  3312. //
  3313. #line 3771 "java.g"
  3314. void Parser::Act227(void)
  3315. {
  3316.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3317.     p -> new_token             = Token(1);
  3318.     p -> array_type            = Sym(2);
  3319.     p -> array_initializer_opt = (AstArrayInitializer *) Sym(3);
  3320.     Sym(1) = p;
  3321. }
  3322.  
  3323. //
  3324. // Rule 228:  DimExprs ::= DimExpr
  3325. //
  3326. #line 3784 "java.g"
  3327. //
  3328. // Note that the list is circular so as to preserve the order of the elements
  3329. //
  3330. void Parser::Act228(void)
  3331. {
  3332.     AstListNode *p = AllocateListNode();
  3333.     p -> next = p;
  3334.     p -> element = Sym(1);
  3335.     p -> index = 0;
  3336.  
  3337.     Sym(1) = p;
  3338. }
  3339.  
  3340. //
  3341. // Rule 229:  DimExprs ::= DimExprs DimExpr
  3342. //
  3343. #line 3801 "java.g"
  3344. //
  3345. // Note that the list is circular so as to preserve the order of the elements
  3346. //
  3347. void Parser::Act229(void)
  3348. {
  3349.     AstListNode *tail = (AstListNode *) Sym(1);
  3350.  
  3351.     AstListNode *p = AllocateListNode();
  3352.     p -> element = Sym(2);
  3353.     p -> index = tail -> index + 1;
  3354.  
  3355.     p -> next = tail -> next;
  3356.     tail -> next = p;
  3357.  
  3358.     Sym(1) = p;
  3359. }
  3360.  
  3361. //
  3362. // Rule 230:  DimExpr ::= LBRACKET Expression RBRACKET
  3363. //
  3364. #line 3822 "java.g"
  3365. void Parser::Act230(void)
  3366. {
  3367.     AstDimExpr *p = ast_pool -> NewDimExpr();
  3368.     p -> left_bracket_token  = Token(1);
  3369.     p -> expression          = (AstExpression *) Sym(2);
  3370.     p -> right_bracket_token = Token(3);
  3371.     Sym(1) = p;
  3372. }
  3373.  
  3374. //
  3375. // Rule 231:  Dims ::= LBRACKET RBRACKET
  3376. //
  3377. #line 3835 "java.g"
  3378. //
  3379. // Note that the list is circular so as to preserve the order of the elements
  3380. //
  3381. void Parser::Act231(void)
  3382. {
  3383.     AstListNode *p = AllocateListNode();
  3384.     p -> next = p;
  3385.     p -> element = ast_pool -> NewBrackets(Token(1), Token(2));
  3386.     p -> index = 0;
  3387.  
  3388.     Sym(1) = p;
  3389. }
  3390.  
  3391. //
  3392. // Rule 232:  Dims ::= Dims LBRACKET RBRACKET
  3393. //
  3394. #line 3852 "java.g"
  3395. //
  3396. // Note that the list is circular so as to preserve the order of the elements
  3397. //
  3398. void Parser::Act232(void)
  3399. {
  3400.     AstListNode *tail = (AstListNode *) Sym(1);
  3401.  
  3402.     AstListNode *p = AllocateListNode();
  3403.     p -> element = ast_pool -> NewBrackets(Token(2), Token(3));
  3404.     p -> index = tail -> index + 1;
  3405.  
  3406.     p -> next = tail -> next;
  3407.     tail -> next = p;
  3408.  
  3409.     Sym(1) = p;
  3410. }
  3411.  
  3412. //
  3413. // Rule 233:  FieldAccess ::= Primary DOT Identifier
  3414. //
  3415. // void MakeFieldAccess(void);
  3416. //
  3417.  
  3418. //
  3419. // Rule 234:  FieldAccess ::= super DOT Identifier
  3420. //
  3421. #line 3880 "java.g"
  3422. void Parser::MakeSuperFieldAccess(void)
  3423. {
  3424.     Sym(1) = ast_pool -> NewSuperExpression(Token(1));
  3425.  
  3426.     MakeFieldAccess();
  3427. }
  3428.  
  3429. //
  3430. // Rule 235:  FieldAccess ::= Name DOT super DOT Identifier
  3431. //
  3432. #line 3892 "java.g"
  3433. void Parser::MakeSuperDoubleFieldAccess(void)
  3434. {
  3435.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  3436.  
  3437.          AstFieldAccess *q = ast_pool -> NewFieldAccess(AstFieldAccess::SUPER_TAG);
  3438.          q -> base = (AstExpression *) Sym(1);
  3439.          q -> dot_token = Token(2);
  3440.          q -> identifier_token = Token(3);
  3441.  
  3442.     p -> base = q;
  3443.     p -> dot_token = Token(4);
  3444.     p -> identifier_token = Token(5);
  3445.  
  3446.     Sym(1) = p;
  3447. }
  3448.  
  3449. //
  3450. // Rule 236:  MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN
  3451. //
  3452. #line 3912 "java.g"
  3453. void Parser::Act236(void)
  3454. {
  3455.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3456.     p -> method                  = (AstExpression *) Sym(1);
  3457.     p -> left_parenthesis_token  = Token(2);
  3458.     if (Sym(3) != NULL)
  3459.     {
  3460.         AstListNode *tail = (AstListNode *) Sym(3);
  3461.         p -> AllocateArguments(tail -> index + 1);
  3462.         AstListNode *root = tail;
  3463.         do
  3464.         {
  3465.             root = root -> next;
  3466.             p -> AddArgument((AstExpression *) root -> element);
  3467.         } while(root != tail);
  3468.         FreeCircularList(tail);
  3469.     }
  3470.     p -> right_parenthesis_token = Token(4);
  3471.     Sym(1) = p;
  3472. }
  3473.  
  3474. //
  3475. // Rule 237:  MethodInvocation ::= Primary DOT Identifier LPAREN ArgumentListopt RPAREN
  3476. //
  3477. #line 3937 "java.g"
  3478. void Parser::Act237(void)
  3479. {
  3480.     MakeFieldAccess();
  3481.  
  3482.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3483.     p -> method                  = (AstExpression *) Sym(1);
  3484.     p -> left_parenthesis_token  = Token(4);
  3485.     if (Sym(5) != NULL)
  3486.     {
  3487.         AstListNode *tail = (AstListNode *) Sym(5);
  3488.         p -> AllocateArguments(tail -> index + 1);
  3489.         AstListNode *root = tail;
  3490.         do
  3491.         {
  3492.             root = root -> next;
  3493.             p -> AddArgument((AstExpression *) root -> element);
  3494.         } while(root != tail);
  3495.         FreeCircularList(tail);
  3496.     }
  3497.     p -> right_parenthesis_token = Token(6);
  3498.     Sym(1) = p;
  3499. }
  3500.  
  3501. //
  3502. // Rule 238:  MethodInvocation ::= super DOT Identifier LPAREN ArgumentListopt RPAREN
  3503. //
  3504. #line 3964 "java.g"
  3505. void Parser::Act238(void)
  3506. {
  3507.     MakeSuperFieldAccess();
  3508.  
  3509.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3510.     p -> method                  = (AstExpression *) Sym(1);
  3511.     p -> left_parenthesis_token  = Token(4);
  3512.     if (Sym(5) != NULL)
  3513.     {
  3514.         AstListNode *tail = (AstListNode *) Sym(5);
  3515.         p -> AllocateArguments(tail -> index + 1);
  3516.         AstListNode *root = tail;
  3517.         do
  3518.         {
  3519.             root = root -> next;
  3520.             p -> AddArgument((AstExpression *) root -> element);
  3521.         } while(root != tail);
  3522.         FreeCircularList(tail);
  3523.     }
  3524.     p -> right_parenthesis_token = Token(6);
  3525.     Sym(1) = p;
  3526. }
  3527.  
  3528. //
  3529. // Rule 239:  MethodInvocation ::= Name DOT super DOT Identifier LPAREN ArgumentListopt RPAREN
  3530. //
  3531. #line 3992 "java.g"
  3532. void Parser::Act239(void)
  3533. {
  3534.     MakeSuperDoubleFieldAccess();
  3535.  
  3536.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3537.     p -> method                  = (AstExpression *) Sym(1);
  3538.     p -> left_parenthesis_token  = Token(6);
  3539.     if (Sym(7) != NULL)
  3540.     {
  3541.         AstListNode *tail = (AstListNode *) Sym(7);
  3542.         p -> AllocateArguments(tail -> index + 1);
  3543.         AstListNode *root = tail;
  3544.         do
  3545.         {
  3546.             root = root -> next;
  3547.             p -> AddArgument((AstExpression *) root -> element);
  3548.         } while(root != tail);
  3549.         FreeCircularList(tail);
  3550.     }
  3551.     p -> right_parenthesis_token = Token(8);
  3552.     Sym(1) = p;
  3553. }
  3554.  
  3555. //
  3556. // Rule 240:  ArrayAccess ::= Name LBRACKET Expression RBRACKET
  3557. //
  3558. #line 4019 "java.g"
  3559. void Parser::MakeArrayAccess(void)
  3560. {
  3561.     AstArrayAccess *p = ast_pool -> NewArrayAccess();
  3562.     p -> base                = (AstExpression *) Sym(1);
  3563.     p -> left_bracket_token  = Token(2);
  3564.     p -> expression          = (AstExpression *) Sym(3);
  3565.     p -> right_bracket_token = Token(4);
  3566.     Sym(1) = p;
  3567. }
  3568.  
  3569. //
  3570. // Rule 241:  ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET
  3571. //
  3572. // void MakeArrayAccess(void);
  3573. //
  3574.  
  3575. //
  3576. // Rule 242:  PostfixExpression -> Primary
  3577. //
  3578. // void NoAction(void);
  3579. //
  3580.  
  3581. //
  3582. // Rule 243:  PostfixExpression -> Name
  3583. //
  3584. // void NoAction(void);
  3585. //
  3586.  
  3587. //
  3588. // Rule 244:  PostfixExpression -> PostIncrementExpression
  3589. //
  3590. // void NoAction(void);
  3591. //
  3592.  
  3593. //
  3594. // Rule 245:  PostfixExpression -> PostDecrementExpression
  3595. //
  3596. // void NoAction(void);
  3597. //
  3598.  
  3599. //
  3600. // Rule 246:  PostIncrementExpression ::= PostfixExpression PLUS_PLUS
  3601. //
  3602. #line 4056 "java.g"
  3603. void Parser::Act246(void)
  3604. {
  3605.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::PLUSPLUS);
  3606.     p -> expression          = (AstExpression *) Sym(1);
  3607.     p -> post_operator_token = Token(2);
  3608.     Sym(1) = p;
  3609. }
  3610.  
  3611. //
  3612. // Rule 247:  PostDecrementExpression ::= PostfixExpression MINUS_MINUS
  3613. //
  3614. #line 4068 "java.g"
  3615. void Parser::Act247(void)
  3616. {
  3617.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::MINUSMINUS);
  3618.     p -> expression          = (AstExpression *) Sym(1);
  3619.     p -> post_operator_token = Token(2);
  3620.     Sym(1) = p;
  3621. }
  3622.  
  3623. //
  3624. // Rule 248:  UnaryExpression -> PreIncrementExpression
  3625. //
  3626. // void NoAction(void);
  3627. //
  3628.  
  3629. //
  3630. // Rule 249:  UnaryExpression -> PreDecrementExpression
  3631. //
  3632. // void NoAction(void);
  3633. //
  3634.  
  3635. //
  3636. // Rule 250:  UnaryExpression ::= PLUS UnaryExpression
  3637. //
  3638. #line 4088 "java.g"
  3639. void Parser::Act250(void)
  3640. {
  3641.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUS);
  3642.     p -> pre_operator_token = Token(1);
  3643.     p -> expression         = (AstExpression *) Sym(2);
  3644.     Sym(1) = p;
  3645. }
  3646.  
  3647. //
  3648. // Rule 251:  UnaryExpression ::= MINUS UnaryExpression
  3649. //
  3650. #line 4100 "java.g"
  3651. void Parser::Act251(void)
  3652. {
  3653.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUS);
  3654.     p -> pre_operator_token = Token(1);
  3655.     p -> expression         = (AstExpression *) Sym(2);
  3656.     Sym(1) = p;
  3657. }
  3658.  
  3659. //
  3660. // Rule 252:  UnaryExpression -> UnaryExpressionNotPlusMinus
  3661. //
  3662. // void NoAction(void);
  3663. //
  3664.  
  3665. //
  3666. // Rule 253:  PreIncrementExpression ::= PLUS_PLUS UnaryExpression
  3667. //
  3668. #line 4116 "java.g"
  3669. void Parser::Act253(void)
  3670. {
  3671.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUSPLUS);
  3672.     p -> pre_operator_token = Token(1);
  3673.     p -> expression         = (AstExpression *) Sym(2);
  3674.     Sym(1) = p;
  3675. }
  3676.  
  3677. //
  3678. // Rule 254:  PreDecrementExpression ::= MINUS_MINUS UnaryExpression
  3679. //
  3680. #line 4128 "java.g"
  3681. void Parser::Act254(void)
  3682. {
  3683.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUSMINUS);
  3684.     p -> pre_operator_token = Token(1);
  3685.     p -> expression         = (AstExpression *) Sym(2);
  3686.     Sym(1) = p;
  3687. }
  3688.  
  3689. //
  3690. // Rule 255:  UnaryExpressionNotPlusMinus -> PostfixExpression
  3691. //
  3692. // void NoAction(void);
  3693. //
  3694.  
  3695. //
  3696. // Rule 256:  UnaryExpressionNotPlusMinus ::= TWIDDLE UnaryExpression
  3697. //
  3698. #line 4144 "java.g"
  3699. void Parser::Act256(void)
  3700. {
  3701.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::TWIDDLE);
  3702.     p -> pre_operator_token = Token(1);
  3703.     p -> expression         = (AstExpression *) Sym(2);
  3704.     Sym(1) = p;
  3705. }
  3706.  
  3707. //
  3708. // Rule 257:  UnaryExpressionNotPlusMinus ::= NOT UnaryExpression
  3709. //
  3710. #line 4156 "java.g"
  3711. void Parser::Act257(void)
  3712. {
  3713.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::NOT);
  3714.     p -> pre_operator_token = Token(1);
  3715.     p -> expression         = (AstExpression *) Sym(2);
  3716.     Sym(1) = p;
  3717. }
  3718.  
  3719. //
  3720. // Rule 258:  UnaryExpressionNotPlusMinus -> CastExpression
  3721. //
  3722. // void NoAction(void);
  3723. //
  3724.  
  3725. //
  3726. // Rule 259:  CastExpression ::= LPAREN PrimitiveType Dimsopt RPAREN UnaryExpression
  3727. //
  3728. #line 4172 "java.g"
  3729. void Parser::MakeCastExpression(void)
  3730. {
  3731.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3732.     p -> left_parenthesis_token_opt  = Token(1);
  3733.     p -> type_opt                    = Sym(2);
  3734.     if (Sym(3) != NULL)
  3735.     {
  3736.         AstListNode *tail = (AstListNode *) Sym(3);
  3737.         p -> AllocateBrackets(tail -> index + 1);
  3738.         AstListNode *root = tail;
  3739.         do
  3740.         {
  3741.             root = root -> next;
  3742.             p -> AddBrackets((AstBrackets *) root -> element);
  3743.         } while(root != tail);
  3744.         FreeCircularList(tail);
  3745.     }
  3746.     p -> right_parenthesis_token_opt = Token(4);
  3747.     p -> expression                  = (AstExpression *) Sym(5);
  3748.     Sym(1) = p;
  3749. }
  3750.  
  3751. //
  3752. // Rule 260:  CastExpression ::= LPAREN Expression RPAREN UnaryExpressionNotPlusMinus
  3753. //
  3754. #line 4198 "java.g"
  3755. void Parser::Act260(void)
  3756. {
  3757.     //
  3758.     // Note that Expression must be a name - i.e., Sym(2) -> isName() == true
  3759.     // This check is not performed here and should be performed during
  3760.     // semantic processing.
  3761.     //
  3762.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3763.     p -> left_parenthesis_token_opt  = Token(1);
  3764.     p -> type_opt                    = Sym(2);
  3765.     p -> right_parenthesis_token_opt = Token(3);
  3766.     p -> expression                  = (AstExpression *) Sym(4);
  3767.     Sym(1) = p;
  3768. }
  3769.  
  3770. //
  3771. // Rule 261:  CastExpression ::= LPAREN Name Dims RPAREN UnaryExpressionNotPlusMinus
  3772. //
  3773. // void MakeCastExpression(void);
  3774. //
  3775.  
  3776. //
  3777. // Rule 262:  MultiplicativeExpression -> UnaryExpression
  3778. //
  3779. // void NoAction(void);
  3780. //
  3781.  
  3782. //
  3783. // Rule 263:  MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY UnaryExpression
  3784. //
  3785. #line 4228 "java.g"
  3786. void Parser::Act263(void)
  3787. {
  3788.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::STAR);
  3789.     p -> left_expression       = (AstExpression *) Sym(1);
  3790.     p -> binary_operator_token = Token(2);
  3791.     p -> right_expression      = (AstExpression *) Sym(3);
  3792.     Sym(1) = p;
  3793. }
  3794.  
  3795. //
  3796. // Rule 264:  MultiplicativeExpression ::= MultiplicativeExpression DIVIDE UnaryExpression
  3797. //
  3798. #line 4241 "java.g"
  3799. void Parser::Act264(void)
  3800. {
  3801.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::SLASH);
  3802.     p -> left_expression       = (AstExpression *) Sym(1);
  3803.     p -> binary_operator_token = Token(2);
  3804.     p -> right_expression      = (AstExpression *) Sym(3);
  3805.     Sym(1) = p;
  3806. }
  3807.  
  3808. //
  3809. // Rule 265:  MultiplicativeExpression ::= MultiplicativeExpression REMAINDER UnaryExpression
  3810. //
  3811. #line 4254 "java.g"
  3812. void Parser::Act265(void)
  3813. {
  3814.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MOD);
  3815.     p -> left_expression       = (AstExpression *) Sym(1);
  3816.     p -> binary_operator_token = Token(2);
  3817.     p -> right_expression      = (AstExpression *) Sym(3);
  3818.     Sym(1) = p;
  3819. }
  3820.  
  3821. //
  3822. // Rule 266:  AdditiveExpression -> MultiplicativeExpression
  3823. //
  3824. // void NoAction(void);
  3825. //
  3826.  
  3827. //
  3828. // Rule 267:  AdditiveExpression ::= AdditiveExpression PLUS MultiplicativeExpression
  3829. //
  3830. #line 4271 "java.g"
  3831. void Parser::Act267(void)
  3832. {
  3833.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::PLUS);
  3834.     p -> left_expression       = (AstExpression *) Sym(1);
  3835.     p -> binary_operator_token = Token(2);
  3836.     p -> right_expression      = (AstExpression *) Sym(3);
  3837.     Sym(1) = p;
  3838. }
  3839.  
  3840. //
  3841. // Rule 268:  AdditiveExpression ::= AdditiveExpression MINUS MultiplicativeExpression
  3842. //
  3843. #line 4284 "java.g"
  3844. void Parser::Act268(void)
  3845. {
  3846.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MINUS);
  3847.     p -> left_expression       = (AstExpression *) Sym(1);
  3848.     p -> binary_operator_token = Token(2);
  3849.     p -> right_expression      = (AstExpression *) Sym(3);
  3850.     Sym(1) = p;
  3851. }
  3852.  
  3853. //
  3854. // Rule 269:  ShiftExpression -> AdditiveExpression
  3855. //
  3856. // void NoAction(void);
  3857. //
  3858.  
  3859. //
  3860. // Rule 270:  ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression
  3861. //
  3862. #line 4301 "java.g"
  3863. void Parser::Act270(void)
  3864. {
  3865.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LEFT_SHIFT);
  3866.     p -> left_expression       = (AstExpression *) Sym(1);
  3867.     p -> binary_operator_token = Token(2);
  3868.     p -> right_expression      = (AstExpression *) Sym(3);
  3869.     Sym(1) = p;
  3870. }
  3871.  
  3872. //
  3873. // Rule 271:  ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression
  3874. //
  3875. #line 4314 "java.g"
  3876. void Parser::Act271(void)
  3877. {
  3878.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::RIGHT_SHIFT);
  3879.     p -> left_expression       = (AstExpression *) Sym(1);
  3880.     p -> binary_operator_token = Token(2);
  3881.     p -> right_expression      = (AstExpression *) Sym(3);
  3882.     Sym(1) = p;
  3883. }
  3884.  
  3885. //
  3886. // Rule 272:  ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT AdditiveExpression
  3887. //
  3888. #line 4327 "java.g"
  3889. void Parser::Act272(void)
  3890. {
  3891.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::UNSIGNED_RIGHT_SHIFT);
  3892.     p -> left_expression       = (AstExpression *) Sym(1);
  3893.     p -> binary_operator_token = Token(2);
  3894.     p -> right_expression      = (AstExpression *) Sym(3);
  3895.     Sym(1) = p;
  3896. }
  3897.  
  3898. //
  3899. // Rule 273:  RelationalExpression -> ShiftExpression
  3900. //
  3901. // void NoAction(void);
  3902. //
  3903.  
  3904. //
  3905. // Rule 274:  RelationalExpression ::= RelationalExpression LESS ShiftExpression
  3906. //
  3907. #line 4344 "java.g"
  3908. void Parser::Act274(void)
  3909. {
  3910.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS);
  3911.     p -> left_expression       = (AstExpression *) Sym(1);
  3912.     p -> binary_operator_token = Token(2);
  3913.     p -> right_expression      = (AstExpression *) Sym(3);
  3914.     Sym(1) = p;
  3915. }
  3916.  
  3917. //
  3918. // Rule 275:  RelationalExpression ::= RelationalExpression GREATER ShiftExpression
  3919. //
  3920. #line 4357 "java.g"
  3921. void Parser::Act275(void)
  3922. {
  3923.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER);
  3924.     p -> left_expression       = (AstExpression *) Sym(1);
  3925.     p -> binary_operator_token = Token(2);
  3926.     p -> right_expression      = (AstExpression *) Sym(3);
  3927.     Sym(1) = p;
  3928. }
  3929.  
  3930. //
  3931. // Rule 276:  RelationalExpression ::= RelationalExpression LESS_EQUAL ShiftExpression
  3932. //
  3933. #line 4370 "java.g"
  3934. void Parser::Act276(void)
  3935. {
  3936.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS_EQUAL);
  3937.     p -> left_expression       = (AstExpression *) Sym(1);
  3938.     p -> binary_operator_token = Token(2);
  3939.     p -> right_expression      = (AstExpression *) Sym(3);
  3940.     Sym(1) = p;
  3941. }
  3942.  
  3943. //
  3944. // Rule 277:  RelationalExpression ::= RelationalExpression GREATER_EQUAL ShiftExpression
  3945. //
  3946. #line 4383 "java.g"
  3947. void Parser::Act277(void)
  3948. {
  3949.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER_EQUAL);
  3950.     p -> left_expression       = (AstExpression *) Sym(1);
  3951.     p -> binary_operator_token = Token(2);
  3952.     p -> right_expression      = (AstExpression *) Sym(3);
  3953.     Sym(1) = p;
  3954. }
  3955.  
  3956. //
  3957. // Rule 278:  RelationalExpression ::= RelationalExpression instanceof ReferenceType
  3958. //
  3959. #line 4396 "java.g"
  3960. void Parser::Act278(void)
  3961. {
  3962.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::INSTANCEOF);
  3963.     p -> left_expression       = (AstExpression *) Sym(1);
  3964.     p -> binary_operator_token = Token(2);
  3965.     p -> right_expression      = ast_pool -> NewTypeExpression(Sym(3));
  3966.     Sym(1) = p;
  3967. }
  3968.  
  3969. //
  3970. // Rule 279:  EqualityExpression -> RelationalExpression
  3971. //
  3972. // void NoAction(void);
  3973. //
  3974.  
  3975. //
  3976. // Rule 280:  EqualityExpression ::= EqualityExpression EQUAL_EQUAL RelationalExpression
  3977. //
  3978. #line 4413 "java.g"
  3979. void Parser::Act280(void)
  3980. {
  3981.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::EQUAL_EQUAL);
  3982.     p -> left_expression       = (AstExpression *) Sym(1);
  3983.     p -> binary_operator_token = Token(2);
  3984.     p -> right_expression      = (AstExpression *) Sym(3);
  3985.     Sym(1) = p;
  3986. }
  3987.  
  3988. //
  3989. // Rule 281:  EqualityExpression ::= EqualityExpression NOT_EQUAL RelationalExpression
  3990. //
  3991. #line 4426 "java.g"
  3992. void Parser::Act281(void)
  3993. {
  3994.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::NOT_EQUAL);
  3995.     p -> left_expression       = (AstExpression *) Sym(1);
  3996.     p -> binary_operator_token = Token(2);
  3997.     p -> right_expression      = (AstExpression *) Sym(3);
  3998.     Sym(1) = p;
  3999. }
  4000.  
  4001. //
  4002. // Rule 282:  AndExpression -> EqualityExpression
  4003. //
  4004. // void NoAction(void);
  4005. //
  4006.  
  4007. //
  4008. // Rule 283:  AndExpression ::= AndExpression AND EqualityExpression
  4009. //
  4010. #line 4444 "java.g"
  4011. void Parser::Act283(void)
  4012. {
  4013.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND);
  4014.     p -> left_expression       = (AstExpression *) Sym(1);
  4015.     p -> binary_operator_token = Token(2);
  4016.     p -> right_expression      = (AstExpression *) Sym(3);
  4017.     Sym(1) = p;
  4018. }
  4019.  
  4020. //
  4021. // Rule 284:  ExclusiveOrExpression -> AndExpression
  4022. //
  4023. // void NoAction(void);
  4024. //
  4025.  
  4026. //
  4027. // Rule 285:  ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression
  4028. //
  4029. #line 4461 "java.g"
  4030. void Parser::Act285(void)
  4031. {
  4032.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::XOR);
  4033.     p -> left_expression       = (AstExpression *) Sym(1);
  4034.     p -> binary_operator_token = Token(2);
  4035.     p -> right_expression      = (AstExpression *) Sym(3);
  4036.     Sym(1) = p;
  4037. }
  4038.  
  4039. //
  4040. // Rule 286:  InclusiveOrExpression -> ExclusiveOrExpression
  4041. //
  4042. // void NoAction(void);
  4043. //
  4044.  
  4045. //
  4046. // Rule 287:  InclusiveOrExpression ::= InclusiveOrExpression OR ExclusiveOrExpression
  4047. //
  4048. #line 4478 "java.g"
  4049. void Parser::Act287(void)
  4050. {
  4051.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::IOR);
  4052.     p -> left_expression       = (AstExpression *) Sym(1);
  4053.     p -> binary_operator_token = Token(2);
  4054.     p -> right_expression      = (AstExpression *) Sym(3);
  4055.     Sym(1) = p;
  4056. }
  4057.  
  4058. //
  4059. // Rule 288:  ConditionalAndExpression -> InclusiveOrExpression
  4060. //
  4061. // void NoAction(void);
  4062. //
  4063.  
  4064. //
  4065. // Rule 289:  ConditionalAndExpression ::= ConditionalAndExpression AND_AND InclusiveOrExpression
  4066. //
  4067. #line 4495 "java.g"
  4068. void Parser::Act289(void)
  4069. {
  4070.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND_AND);
  4071.     p -> left_expression       = (AstExpression *) Sym(1);
  4072.     p -> binary_operator_token = Token(2);
  4073.     p -> right_expression      = (AstExpression *) Sym(3);
  4074.     Sym(1) = p;
  4075. }
  4076.  
  4077. //
  4078. // Rule 290:  ConditionalOrExpression -> ConditionalAndExpression
  4079. //
  4080. // void NoAction(void);
  4081. //
  4082.  
  4083. //
  4084. // Rule 291:  ConditionalOrExpression ::= ConditionalOrExpression OR_OR ConditionalAndExpression
  4085. //
  4086. #line 4512 "java.g"
  4087. void Parser::Act291(void)
  4088. {
  4089.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::OR_OR);
  4090.     p -> left_expression       = (AstExpression *) Sym(1);
  4091.     p -> binary_operator_token = Token(2);
  4092.     p -> right_expression      = (AstExpression *) Sym(3);
  4093.     Sym(1) = p;
  4094. }
  4095.  
  4096. //
  4097. // Rule 292:  ConditionalExpression -> ConditionalOrExpression
  4098. //
  4099. // void NoAction(void);
  4100. //
  4101.  
  4102. //
  4103. // Rule 293:  ConditionalExpression ::= ConditionalOrExpression QUESTION Expression COLON ConditionalExpression
  4104. //
  4105. #line 4529 "java.g"
  4106. void Parser::Act293(void)
  4107. {
  4108.     AstConditionalExpression *p = ast_pool -> NewConditionalExpression();
  4109.     p -> test_expression  = (AstExpression *) Sym(1);
  4110.     p -> question_token   = Token(2);
  4111.     p -> true_expression  = (AstExpression *) Sym(3);
  4112.     p -> colon_token      = Token(4);
  4113.     p -> false_expression = (AstExpression *) Sym(5);
  4114.     Sym(1) = p;
  4115. }
  4116.  
  4117. //
  4118. // Rule 294:  AssignmentExpression -> ConditionalExpression
  4119. //
  4120. // void NoAction(void);
  4121. //
  4122.  
  4123. //
  4124. // Rule 295:  AssignmentExpression -> Assignment
  4125. //
  4126. // void NoAction(void);
  4127. //
  4128.  
  4129. //
  4130. // Rule 296:  Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression
  4131. //
  4132. #line 4552 "java.g"
  4133. void Parser::Act296(void)
  4134. {
  4135.     AstAssignmentExpression *p = (AstAssignmentExpression *) Sym(2);
  4136.     p -> left_hand_side = (AstExpression *) Sym(1);
  4137.     p -> expression     = (AstExpression *) Sym(3);
  4138.     Sym(1) = p;
  4139. }
  4140.  
  4141. //
  4142. // Rule 297:  LeftHandSide -> Name
  4143. //
  4144. // void NoAction(void);
  4145. //
  4146.  
  4147. //
  4148. // Rule 298:  LeftHandSide -> FieldAccess
  4149. //
  4150. // void NoAction(void);
  4151. //
  4152.  
  4153. //
  4154. // Rule 299:  LeftHandSide -> ArrayAccess
  4155. //
  4156. // void NoAction(void);
  4157. //
  4158.  
  4159. //
  4160. // Rule 300:  AssignmentOperator ::= EQUAL
  4161. //
  4162. #line 4576 "java.g"
  4163. void Parser::Act300(void)
  4164. {
  4165.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::EQUAL, Token(1));
  4166. }
  4167.  
  4168. //
  4169. // Rule 301:  AssignmentOperator ::= MULTIPLY_EQUAL
  4170. //
  4171. #line 4585 "java.g"
  4172. void Parser::Act301(void)
  4173. {
  4174.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::STAR_EQUAL, Token(1));
  4175. }
  4176.  
  4177. //
  4178. // Rule 302:  AssignmentOperator ::= DIVIDE_EQUAL
  4179. //
  4180. #line 4594 "java.g"
  4181. void Parser::Act302(void)
  4182. {
  4183.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::SLASH_EQUAL, Token(1));
  4184. }
  4185.  
  4186. //
  4187. // Rule 303:  AssignmentOperator ::= REMAINDER_EQUAL
  4188. //
  4189. #line 4603 "java.g"
  4190. void Parser::Act303(void)
  4191. {
  4192.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MOD_EQUAL, Token(1));
  4193. }
  4194.  
  4195. //
  4196. // Rule 304:  AssignmentOperator ::= PLUS_EQUAL
  4197. //
  4198. #line 4612 "java.g"
  4199. void Parser::Act304(void)
  4200. {
  4201.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::PLUS_EQUAL, Token(1));
  4202. }
  4203.  
  4204. //
  4205. // Rule 305:  AssignmentOperator ::= MINUS_EQUAL
  4206. //
  4207. #line 4621 "java.g"
  4208. void Parser::Act305(void)
  4209. {
  4210.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MINUS_EQUAL, Token(1));
  4211. }
  4212.  
  4213. //
  4214. // Rule 306:  AssignmentOperator ::= LEFT_SHIFT_EQUAL
  4215. //
  4216. #line 4630 "java.g"
  4217. void Parser::Act306(void)
  4218. {
  4219.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::LEFT_SHIFT_EQUAL, Token(1));
  4220. }
  4221.  
  4222. //
  4223. // Rule 307:  AssignmentOperator ::= RIGHT_SHIFT_EQUAL
  4224. //
  4225. #line 4639 "java.g"
  4226. void Parser::Act307(void)
  4227. {
  4228.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::RIGHT_SHIFT_EQUAL, Token(1));
  4229. }
  4230.  
  4231. //
  4232. // Rule 308:  AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL
  4233. //
  4234. #line 4648 "java.g"
  4235. void Parser::Act308(void)
  4236. {
  4237.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::UNSIGNED_RIGHT_SHIFT_EQUAL, Token(1));
  4238. }
  4239.  
  4240. //
  4241. // Rule 309:  AssignmentOperator ::= AND_EQUAL
  4242. //
  4243. #line 4657 "java.g"
  4244. void Parser::Act309(void)
  4245. {
  4246.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::AND_EQUAL, Token(1));
  4247. }
  4248.  
  4249. //
  4250. // Rule 310:  AssignmentOperator ::= XOR_EQUAL
  4251. //
  4252. #line 4666 "java.g"
  4253. void Parser::Act310(void)
  4254. {
  4255.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::XOR_EQUAL, Token(1));
  4256. }
  4257.  
  4258. //
  4259. // Rule 311:  AssignmentOperator ::= OR_EQUAL
  4260. //
  4261. #line 4675 "java.g"
  4262. void Parser::Act311(void)
  4263. {
  4264.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::IOR_EQUAL, Token(1));
  4265. }
  4266.  
  4267. //
  4268. // Rule 312:  Expression -> AssignmentExpression
  4269. //
  4270. // void NoAction(void);
  4271. //
  4272.  
  4273. //
  4274. // Rule 313:  ConstantExpression -> Expression
  4275. //
  4276. // void NoAction(void);
  4277. //
  4278.  
  4279. //
  4280. // Rule 314:  PackageDeclarationopt ::=
  4281. //
  4282. #line 4698 "java.g"
  4283. //
  4284. // Given a rule of the form A ::= x1 x2 ... xn
  4285. //
  4286. // Construct a NULL Ast for A.
  4287. //
  4288. void Parser::NullAction(void) { Sym(1) = NULL; }
  4289.  
  4290. //
  4291. // Rule 315:  PackageDeclarationopt -> PackageDeclaration
  4292. //
  4293. // void NoAction(void);
  4294. //
  4295.  
  4296. //
  4297. // Rule 316:  Superopt ::=
  4298. //
  4299. // void NullAction(void);
  4300. //
  4301.  
  4302. //
  4303. // Rule 317:  Superopt -> Super
  4304. //
  4305. // void NoAction(void);
  4306. //
  4307.  
  4308. //
  4309. // Rule 318:  Expressionopt ::=
  4310. //
  4311. // void NullAction(void);
  4312. //
  4313.  
  4314. //
  4315. // Rule 319:  Expressionopt -> Expression
  4316. //
  4317. // void NoAction(void);
  4318. //
  4319.  
  4320. //
  4321. // Rule 320:  ClassBodyopt ::=
  4322. //
  4323. // void NullAction(void);
  4324. //
  4325.  
  4326. //
  4327. // Rule 321:  ClassBodyopt -> ClassBody
  4328. //
  4329. // void NoAction(void);
  4330. //
  4331.  
  4332. //
  4333. // Rule 322:  ,opt ::=
  4334. //
  4335. // void NullAction(void);
  4336. //
  4337.  
  4338. //
  4339. // Rule 323:  ,opt -> COMMA
  4340. //
  4341. // void NoAction(void);
  4342. //
  4343.  
  4344. //
  4345. // Rule 324:  ImportDeclarationsopt ::=
  4346. //
  4347. // void NullAction(void);
  4348. //
  4349.  
  4350. //
  4351. // Rule 325:  ImportDeclarationsopt -> ImportDeclarations
  4352. //
  4353. // void NoAction(void);
  4354. //
  4355.  
  4356. //
  4357. // Rule 326:  TypeDeclarationsopt ::=
  4358. //
  4359. // void NullAction(void);
  4360. //
  4361.  
  4362. //
  4363. // Rule 327:  TypeDeclarationsopt -> TypeDeclarations
  4364. //
  4365. // void NoAction(void);
  4366. //
  4367.  
  4368. //
  4369. // Rule 328:  ClassBodyDeclarationsopt ::=
  4370. //
  4371. // void NullAction(void);
  4372. //
  4373.  
  4374. //
  4375. // Rule 329:  ClassBodyDeclarationsopt -> ClassBodyDeclarations
  4376. //
  4377. // void NoAction(void);
  4378. //
  4379.  
  4380. //
  4381. // Rule 330:  Modifiersopt ::=
  4382. //
  4383. // void NullAction(void);
  4384. //
  4385.  
  4386. //
  4387. // Rule 331:  Modifiersopt -> Modifiers
  4388. //
  4389. // void NoAction(void);
  4390. //
  4391.  
  4392. //
  4393. // Rule 332:  BlockStatementsopt ::=
  4394. //
  4395. // void NullAction(void);
  4396. //
  4397.  
  4398. //
  4399. // Rule 333:  BlockStatementsopt -> BlockStatements
  4400. //
  4401. // void NoAction(void);
  4402. //
  4403.  
  4404. //
  4405. // Rule 334:  Dimsopt ::=
  4406. //
  4407. // void NullAction(void);
  4408. //
  4409.  
  4410. //
  4411. // Rule 335:  Dimsopt -> Dims
  4412. //
  4413. // void NoAction(void);
  4414. //
  4415.  
  4416. //
  4417. // Rule 336:  ArgumentListopt ::=
  4418. //
  4419. // void NullAction(void);
  4420. //
  4421.  
  4422. //
  4423. // Rule 337:  ArgumentListopt -> ArgumentList
  4424. //
  4425. // void NoAction(void);
  4426. //
  4427.  
  4428. //
  4429. // Rule 338:  Throwsopt ::=
  4430. //
  4431. // void NullAction(void);
  4432. //
  4433.  
  4434. //
  4435. // Rule 339:  Throwsopt -> Throws
  4436. //
  4437. // void NoAction(void);
  4438. //
  4439.  
  4440. //
  4441. // Rule 340:  FormalParameterListopt ::=
  4442. //
  4443. // void NullAction(void);
  4444. //
  4445.  
  4446. //
  4447. // Rule 341:  FormalParameterListopt -> FormalParameterList
  4448. //
  4449. // void NoAction(void);
  4450. //
  4451.  
  4452. //
  4453. // Rule 342:  Interfacesopt ::=
  4454. //
  4455. // void NullAction(void);
  4456. //
  4457.  
  4458. //
  4459. // Rule 343:  Interfacesopt -> Interfaces
  4460. //
  4461. // void NoAction(void);
  4462. //
  4463.  
  4464. //
  4465. // Rule 344:  InterfaceMemberDeclarationsopt ::=
  4466. //
  4467. // void NullAction(void);
  4468. //
  4469.  
  4470. //
  4471. // Rule 345:  InterfaceMemberDeclarationsopt -> InterfaceMemberDeclarations
  4472. //
  4473. // void NoAction(void);
  4474. //
  4475.  
  4476. //
  4477. // Rule 346:  ForInitopt ::=
  4478. //
  4479. // void NullAction(void);
  4480. //
  4481.  
  4482. //
  4483. // Rule 347:  ForInitopt -> ForInit
  4484. //
  4485. // void NoAction(void);
  4486. //
  4487.  
  4488. //
  4489. // Rule 348:  ForUpdateopt ::=
  4490. //
  4491. // void NullAction(void);
  4492. //
  4493.  
  4494. //
  4495. // Rule 349:  ForUpdateopt -> ForUpdate
  4496. //
  4497. // void NoAction(void);
  4498. //
  4499.  
  4500. //
  4501. // Rule 350:  ExtendsInterfacesopt ::=
  4502. //
  4503. // void NullAction(void);
  4504. //
  4505.  
  4506. //
  4507. // Rule 351:  ExtendsInterfacesopt -> ExtendsInterfaces
  4508. //
  4509. // void NoAction(void);
  4510. //
  4511.  
  4512. //
  4513. // Rule 352:  Catchesopt ::=
  4514. //
  4515. // void NullAction(void);
  4516. //
  4517.  
  4518. //
  4519. // Rule 353:  Catchesopt -> Catches
  4520. //
  4521. // void NoAction(void);
  4522. //
  4523.  
  4524. //
  4525. // Rule 354:  PackageHeaderMarker ::=
  4526. //
  4527. #line 4879 "java.g"
  4528. //
  4529. // When this function is invoked, if the "parse_package_header_only" flag
  4530. // is turned on, we skip to the end-of-file token.
  4531. //
  4532. void Parser::Act354(void)
  4533. {
  4534.     if (parse_package_header_only)
  4535.         lex_stream -> Reset(lex_stream -> NumTokens() - 1); // point to the EOF token
  4536.     Sym(1) = NULL;
  4537. }
  4538.  
  4539. //
  4540. // Rule 355:  MethodHeaderMarker ::=
  4541. //
  4542. #line 4894 "java.g"
  4543. //
  4544. // When this function is invoked, if the "parse_header_only" flag
  4545. // is turned on, the body of the method being parsed is skipped.
  4546. //
  4547. void Parser::Act355(void)
  4548. {
  4549.     if (parse_header_only)
  4550.     {
  4551.         TokenObject token = Token(1);
  4552.  
  4553.         //
  4554.         // If the first token immediately following the method header
  4555.         // is not an open brace, then we have a syntactic error. Do
  4556.         // nothing and let the error recovery take care of it.
  4557.         //
  4558.         if (lex_stream -> Kind(token) == TK_LBRACE)
  4559.             lex_stream -> Reset(lex_stream -> MatchingBrace(token));
  4560.     }
  4561.  
  4562.     Sym(1) = NULL;
  4563. }
  4564.